當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PHP_Timer::timeSinceStartOfRequest方法代碼示例

本文整理匯總了PHP中PHP_Timer::timeSinceStartOfRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHP_Timer::timeSinceStartOfRequest方法的具體用法?PHP PHP_Timer::timeSinceStartOfRequest怎麽用?PHP PHP_Timer::timeSinceStartOfRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PHP_Timer的用法示例。


在下文中一共展示了PHP_Timer::timeSinceStartOfRequest方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

<hr>
<small>

    <?php 
if (isset($hasControllerActionTime)) {
    ?>
        <div>Controller Action Execution Time: <?php 
    echo PHP_Timer::secondsToTimeString(PHP_Timer::stop());
    ?>
</div>
    <?php 
}
?>

    <div>Execution Time: <?php 
echo PHP_Timer::timeSinceStartOfRequest();
?>
</div>

    <?php 
if (isset($bootstrapTime)) {
    ?>
        <div>Application Bootstrap Time: <?php 
    echo $bootstrapTime;
    ?>
</div>
    <?php 
}
?>

    <?php 
開發者ID:view-components,項目名稱:testing-helpers,代碼行數:31,代碼來源:timing.php

示例2: testTimeSinceStartOfRequest

 /**
  * @covers PHP_Timer::timeSinceStartOfRequest
  */
 public function testTimeSinceStartOfRequest()
 {
     $this->assertStringMatchesFormat('%i %s', PHP_Timer::timeSinceStartOfRequest());
 }
開發者ID:nbalonso,項目名稱:MunkiFace,代碼行數:7,代碼來源:TimerTest.php

示例3: printFooter

 /**
  * @param  PHPUnit_Framework_TestResult  $result
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     $this->write(sprintf("\nFinished in %s\n", PHP_Timer::timeSinceStartOfRequest()));
     $resultsCount = count($result);
     $footer = sprintf("%d test%s, %d assertion%s", $resultsCount, $resultsCount == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's');
     if ($result->wasSuccessful() && $result->allCompletelyImplemented() && $result->noneSkipped()) {
         $this->write($this->green($footer));
     } else {
         if ((!$result->allCompletelyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             $footer .= sprintf("%s%s", $this->getCountString($result->notImplementedCount(), 'incomplete'), $this->getCountString($result->skippedCount(), 'skipped'));
             $this->write($this->yellow($footer));
         } else {
             $footer .= sprintf("%s%s%s%s", $this->getCountString($result->failureCount(), 'failures'), $this->getCountString($result->errorCount(), 'errors'), $this->getCountString($result->notImplementedCount(), 'incomplete'), $this->getCountString($result->skippedCount(), 'skipped'));
             $footer = preg_replace('/,$/', '', $footer);
             $this->write($this->red($footer));
         }
     }
     // if ( ! $this->verbose &&
     //   $result->deprecatedFeaturesCount() > 0 )
     // {
     //   $message = sprintf(
     //     "Warning: Deprecated PHPUnit features are being used %s times!\n".
     //     "Use --verbose for more information.\n",
     //     $result->deprecatedFeaturesCount()
     //   );
     //
     //   if ($this->colors) {
     //     $message = "\x1b[37;41m\x1b[2K" . $message .
     //       "\x1b[0m";
     //   }
     //
     //   $this->write("\n" . $message);
     // }
     $this->writeNewLine();
 }
開發者ID:michaelachrisco,項目名稱:phpunit-progress,代碼行數:38,代碼來源:ResultPrinter.php

示例4: printFooter

 /**
  * @param  PHPUnit_Framework_TestResult  $result
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     $this->write(sprintf("\nFinished in %s\n", PHP_Timer::timeSinceStartOfRequest()));
     $resultsCount = count($result);
     $footer = sprintf("%d test%s, %d assertion%s", $resultsCount, $resultsCount == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's');
     // backwards/forwards compatibility hack for naming fix from phpunit 3.7.11
     // @see https://github.com/sebastianbergmann/phpunit/issues/762
     $allCompletelyImplemented = method_exists($result, 'allCompletelyImplemented') ? 'allCompletelyImplemented' : 'allCompletlyImplemented';
     if ($result->wasSuccessful() && $result->{$allCompletelyImplemented}() && $result->noneSkipped()) {
         $this->write($this->green($footer));
     } else {
         if ((!$result->{$allCompletelyImplemented}() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             $footer .= sprintf("%s%s", $this->getCountString($result->notImplementedCount(), 'incomplete'), $this->getCountString($result->skippedCount(), 'skipped'));
             $this->write($this->yellow($footer));
         } else {
             $footer .= sprintf("%s%s%s%s", $this->getCountString($result->failureCount(), 'failures'), $this->getCountString($result->errorCount(), 'errors'), $this->getCountString($result->notImplementedCount(), 'incomplete'), $this->getCountString($result->skippedCount(), 'skipped'));
             $footer = preg_replace('/,$/', '', $footer);
             $this->write($this->red($footer));
         }
     }
     if (method_exists($result, 'deprecatedFeaturesCount')) {
         if (!$this->verbose && $result->deprecatedFeaturesCount() > 0) {
             $message = sprintf("Warning: Deprecated PHPUnit features are being used %s times!\n" . "Use --verbose for more information.\n", $result->deprecatedFeaturesCount());
             if ($this->colors) {
                 $message = "[37;41m[2K" . $message . "[0m";
             }
             $this->write("\n" . $message);
         }
     }
     $this->writeNewLine();
 }
開發者ID:joskfg,項目名稱:guard-phpunit2,代碼行數:34,代碼來源:ResultPrinter.php

示例5: PDO

            $pdo = new PDO($dsn, $dbItem['username'], $dbItem['password']);
        } catch (\PDOException $e) {
            throw new \Exception('connect to db failed: [' . $dsn . ']');
        }
        $sql = $query->getSql();
        dump($sql);
        $statement = $pdo->query($sql);
        $resultSet = $statement->fetchAll(PDO::FETCH_ASSOC);
        return array_map(function (array $data) {
            return $data['snsid'];
        }, $resultSet);
    }
}
$options = getopt('', ['concurrency:', 'date:', 'gv:']);
$concurrency = isset($options['concurrency']) ? (int) $options['concurrency'] : 100;
$gameVersion = isset($options['gv']) ? $options['gv'] : 'tw';
appendLog('game version: ' . $gameVersion . ', concurrency: ' . $concurrency);
$base = __DIR__ . '/../../../farm-server-conf/';
assert(is_dir($base));
$esHost = '52.19.73.190';
$esPort = 9200;
$esClient = new Client(['hosts' => [sprintf('http://%s:%d/', $esHost, $esPort)]]);
//$docUpdater = new DocumentUpdater($esClient, $gameVersion);
$docUpdater = new NonBlockingDocUpdater($concurrency);
$updater = new UserStatusUpdater($gameVersion);
dump($options);
$query = array_key_exists('date', $options) ? new AllDeAuthorizedUserQuery($options['date']) : new DeAuthorizedUserQuery();
$resultSet = $updater->run(\Environment\PlatformFactory::make($gameVersion), $query, $docUpdater);
dump($resultSet);
dump('Run time: ' . PHP_Timer::timeSinceStartOfRequest());
dump(sprintf('Memory: %4.2fMb', memory_get_peak_usage(true) / 1048576));
開發者ID:jiangyu7408,項目名稱:notification,代碼行數:31,代碼來源:disableUser.php


注:本文中的PHP_Timer::timeSinceStartOfRequest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。