本文整理汇总了PHP中Nette\Debug::timer方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::timer方法的具体用法?PHP Debug::timer怎么用?PHP Debug::timer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Debug
的用法示例。
在下文中一共展示了Debug::timer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stopQuery
/**
* {@inheritdoc}
*/
public function stopQuery()
{
$executionMS = Debug::timer(self::TIMER_NAME);
$this->queries[$this->i]['execution'] = round($executionMS * 1000, 3);
$this->totalTime += $executionMS * 1000;
$this->i++;
}
示例2: processDelete
private function processDelete()
{
$ids = $this->getRandomsNumbers(50, 50000, 1);
$queryesExecution = array();
$peoples = array();
foreach ($ids as $id) {
Debug::timer();
// SELECT + DELETE DATA
$people = Models\People::find($id);
$peoples[] = $people;
$people->delete();
$queryesExecution[] = number_format(Debug::timer() * 1000, 2);
}
return array($queryesExecution, $peoples);
}
示例3: date
namespace App;
require_once __DIR__ . "/bootstrap.php";
use Nette\Debug, Nette\Framework, dibi;
Debug::timer('benchmark');
$memory = memory_get_peak_usage();
echoBeginHtml();
/********************************************************************************************************************************/
// Setum entity manager
$em = new \ActiveMapper\Manager(\dibi::getConnection());
echo "<h1>All authors</h1>";
// Get all authors
$authors = $em->findAll('App\\Models\\Author');
foreach ($authors as $author) {
Debug::dump($author->name);
Debug::dump($author->blog->name);
}
echo "<h1>Author by ID #3</h1>";
// Get author by id
$author = $em->find('App\\Models\\Author', 3);
Debug::dump($author->name);
Debug::dump($author->blog->name);
/********************************************************************************************************************************/
// Benchmark data
Debug::barDump(Framework::NAME . " " . Framework::VERSION . " " . Framework::REVISION);
Debug::barDump("dibi " . dibi::VERSION . " " . dibi::REVISION);
Debug::barDump($mappingTime = number_format(Debug::timer('benchmark') * 1000, 1, '.', ' ') . "ms", "Mapping Time");
Debug::barDump($mappingMemory = number_format((memory_get_peak_usage() - $memory) / 1000, 1, '.', ' ') . "kB", "Mapping Memory");
echo '<p><a href="http://github.com/Vrtak-CZ/ActiveMapper/blob/master/examples/index.php" target="_blank">' . 'Show code on GitHub</a> - <a href="http://am.vrtak-cz.net/coverage">Show coverage</a></p>';
$benchMarkData = "mapping time: {$mappingTime} mapping memory: {$mappingMemory} " . "total time: " . number_format((microtime(TRUE) - Debug::$time) * 1000, 1, '.', ' ') . "ms " . "total memory: " . number_format(memory_get_peak_usage() / 1000, 1, '.', ' ') . "kB";
file_put_contents(__DIR__ . "/benchmark.log", date("r") . " # " . $benchMarkData . PHP_EOL, FILE_APPEND);