当前位置: 首页>>代码示例>>PHP>>正文


PHP Debug::timer方法代码示例

本文整理汇总了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++;
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:10,代码来源:Doctrine2Panel.php

示例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);
 }
开发者ID:vrana,项目名称:ORM-benchmark,代码行数:15,代码来源:HomepagePresenter.php

示例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);
开发者ID:nella,项目名称:ActiveMapper,代码行数:31,代码来源:index.php


注:本文中的Nette\Debug::timer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。