/** * Render the profiler output. * * @return \stdClass * * @since 1.0 */ private function getProfile() { $points = $this->profiler->getPoints(); $pointStart = $points[0]->getName(); $pointEnd = $points[count($points) - 1]->getName(); $profile = new \stdClass(); $profile->peak = $this->profiler->getMemoryBytesBetween($pointStart, $pointEnd); $profile->time = $this->profiler->getTimeBetween($pointStart, $pointEnd); return $profile; }
/** * @covers \Joomla\Profiler\Profiler::getMemoryBytesBetween * @uses \Joomla\Profiler\Profiler::__construct * * @expectedException \LogicException */ public function testTheProfilerCannotMeasureMemoryBetweenTwoPointsIfTheFirstPointDoesNotExist() { $first = new ProfilePoint('start'); $profiler = new Profiler('test', null, array($first)); $profiler->getMemoryBytesBetween('foo', 'start'); }
/** * Tests the getMemoryBytesBetween method exception. * When the first point doesn't exist. * * @return void * * @covers \Joomla\Profiler\Profiler::getMemoryBytesBetween * @expectedException \LogicException * @since 1.0 */ public function testGetMemoryBytesBetweenExceptionFirst() { $first = new ProfilePoint('start'); $profiler = new Profiler('test', null, array($first)); $profiler->getMemoryBytesBetween('foo', 'start'); }