本文整理汇总了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
示例2: testTimeSinceStartOfRequest
/**
* @covers PHP_Timer::timeSinceStartOfRequest
*/
public function testTimeSinceStartOfRequest()
{
$this->assertStringMatchesFormat('%i %s', PHP_Timer::timeSinceStartOfRequest());
}
示例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();
}
示例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();
}
示例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));