/** * @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'; }
protected function getRuntime(Item $item) { return $item->getStatistic(self::class, self::FILED_RUNTIME); }
/** * @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)); }