コード例 #1
0
ファイル: ItemTest.php プロジェクト: acgrid/phprofiling
 /**
  * @param Item $item
  */
 public function onFinish(Item $item)
 {
     $this->assertTrue($item->hasStatistics(self::class));
     $this->assertTrue($item->hasStatistics(self::class, 'onStart'));
     $this->assertTrue($item->getStatistic(self::class, 'onStart'));
     $this->assertTrue($item->getStatistic(self::class, 'onResume'));
     $this->assertTrue($item->getStatistic(self::class, 'onPause'));
     $ref =& $item->refScopeStatistic(self::class);
     $this->assertCount(4, $ref);
     $this->assertTrue($ref['onStop']);
     $ref['Ref'] = true;
     $this->assertTrue($item->getStatistic(self::class, 'Ref'));
     echo 'onFinish';
 }
コード例 #2
0
ファイル: TimingObserver.php プロジェクト: acgrid/phprofiling
 protected function getRuntime(Item $item)
 {
     return $item->getStatistic(self::class, self::FILED_RUNTIME);
 }
コード例 #3
0
 /**
  * @param Item $item
  */
 public function onStop(Item $item)
 {
     $item->setStatistic(static::class, static::FILED_MEMORY_USAGE, memory_get_peak_usage($this->realUsage) - $item->getStatistic(static::class, static::FILED_MEMORY_USAGE));
 }