コード例 #1
0
ファイル: Timers.php プロジェクト: titounnes/CodeIgniter4
 /**
  * Child classes should implement this to return the timeline data
  * formatted for correct usage.
  *
  * @return mixed
  */
 protected function formatTimelineData() : array
 {
     $data = [];
     $benchmark = Services::timer(true);
     $rows = $benchmark->getTimers(6);
     foreach ($rows as $name => $info) {
         if ($name == 'total_execution') {
             continue;
         }
         $data[] = ['name' => ucwords(str_replace('_', ' ', $name)), 'component' => 'Timer', 'start' => $info['start'], 'duration' => $info['end'] - $info['start']];
     }
     return $data;
 }
コード例 #2
0
 /**
  * Start the Benchmark
  * 
  * The timer is used to display total script execution both in the
  * debug toolbar, and potentially on the displayed page.
  */
 protected function startBenchmark()
 {
     $this->startTime = microtime(true);
     $this->benchmark = Services::timer();
     $this->benchmark->start('total_execution', $this->startTime);
     $this->benchmark->start('bootstrap');
 }