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


PHP DebugKitDebugger::elapsedTime方法代碼示例

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


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

示例1: testTimers

 /**
  * Start Timer test
  *
  * @return void
  **/
 function testTimers()
 {
     $this->assertTrue(DebugKitDebugger::startTimer('test1', 'this is my first test'));
     usleep(5000);
     $this->assertTrue(DebugKitDebugger::stopTimer('test1'));
     $elapsed = DebugKitDebugger::elapsedTime('test1');
     $this->assertTrue($elapsed > 0.005);
     $this->assertTrue(DebugKitDebugger::startTimer('test2', 'this is my second test'));
     sleep(1);
     $this->assertTrue(DebugKitDebugger::stopTimer('test2'));
     $elapsed = DebugKitDebugger::elapsedTime('test2');
     $this->assertTrue($elapsed > 1);
     DebugKitDebugger::startTimer('test3');
     $this->assertFalse(DebugKitDebugger::elapsedTime('test3'));
     $this->assertFalse(DebugKitDebugger::stopTimer('wrong'));
 }
開發者ID:afzet,項目名稱:cake-cart,代碼行數:21,代碼來源:debug_kit_debugger.test.php

示例2: testTimers

/**
 * Start Timer test
 *
 * @return void
 **/
	public function testTimers() {
		$this->assertTrue(DebugKitDebugger::startTimer('test1', 'this is my first test'));
		usleep(5000);
		$this->assertTrue(DebugKitDebugger::stopTimer('test1'));
		$elapsed = DebugKitDebugger::elapsedTime('test1');
		$this->assertTrue($elapsed > 0.0050);

		$this->assertTrue(DebugKitDebugger::startTimer('test2', 'this is my second test'));
		sleep(1);
		$this->assertTrue(DebugKitDebugger::stopTimer('test2'));
		$elapsed = DebugKitDebugger::elapsedTime('test2');
		$expected = strpos(PHP_OS, 'WIN') === false ? 1 : 0.95; // Windows timer's precision is bad
		$this->assertTrue($elapsed > $expected);

		DebugKitDebugger::startTimer('test3');
		$this->assertIdentical(DebugKitDebugger::elapsedTime('test3'), 0);
		$this->assertFalse(DebugKitDebugger::stopTimer('wrong'));
	}
開發者ID:neterslandreau,項目名稱:tubones,代碼行數:23,代碼來源:DebugKitDebuggerTest.php

示例3: getTimers

 /**
  * Get all timers that have been started and stopped.
  * Calculates elapsed time for each timer.
  *
  * @return array
  **/
 function getTimers()
 {
     $_this =& DebugKitDebugger::getInstance();
     $times = array();
     foreach ($_this->__benchmarks as $name => $timer) {
         $times[$name]['time'] = DebugKitDebugger::elapsedTime($name);
         $times[$name]['message'] = $timer['message'];
     }
     return $times;
 }
開發者ID:masayukiando,項目名稱:cakephp1.3-mailmagazine,代碼行數:16,代碼來源:debug_kit_debugger.php

示例4: getTimers

 /**
  * Get all timers that have been started and stopped.
  * Calculates elapsed time for each timer. If clear is true, will delete existing timers
  *
  * @param bool $clear false
  * @return array
  * @access public
  **/
 function getTimers($clear = false)
 {
     $_this =& DebugKitDebugger::getInstance();
     $start = DebugKitDebugger::requestStartTime();
     $now = getMicrotime();
     $times = array();
     if (!empty($_this->__benchmarks)) {
         $firstTimer = current($_this->__benchmarks);
         $_end = $firstTimer['start'];
     } else {
         $_end = $now;
     }
     $times['Core Processing (Derived)'] = array('message' => __d('debug_kit', 'Core Processing (Derived)', true), 'start' => 0, 'end' => $_end - $start, 'time' => round($_end - $start, 6), 'named' => null);
     foreach ($_this->__benchmarks as $name => $timer) {
         if (!isset($timer['end'])) {
             $timer['end'] = $now;
         }
         $times[$name] = array_merge($timer, array('start' => $timer['start'] - $start, 'end' => $timer['end'] - $start, 'time' => DebugKitDebugger::elapsedTime($name)));
     }
     if ($clear) {
         $_this->__benchmarks = array();
     }
     return $times;
 }
開發者ID:ambagasdowa,項目名稱:kml,代碼行數:32,代碼來源:debug_kit_debugger.php


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