public function processProfile(Profile $prof) { $duration = $prof->getElapsedMs(); if ($duration > $this->max) { $this->max = $duration; } return $this; }
public function testProfile() { $prof = new Profile(); $prof->start = new MicroTime(5, 5); $prof->end = new MicroTime(10, 10); $this->assertEquals(5005, $prof->getElapsedMs()); $this->assertEquals(5.005, $prof->getElapsedSeconds()); }
public function processProfile(Profile $prof) { // NOTE: We must make the key a string. // Floats get cast to ints when used as array keys. As such // any value < 1 gets cast to 0 $duration = "{$prof->getElapsedMs()}"; if (!isset($this->elements[$duration])) { $this->elements[$duration] = 0; } $this->elements[$duration]++; return $this; }
public function processProfile(Profile $prof) { $this->sum += $prof->getElapsedMs(); return $this; }
public function processProfile(Profile $prof) { $this->count++; $this->mean = $this->mean - ($this->mean - $prof->getElapsedMs()) / $this->count; return $this; }