當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。