/** * A lower level combination of start and end. * * Intended to allow use of the profiler to keep track of * the profiling data without the overhead of multiple function calls * * @param string $start microtime result from the start of the profiling * @param string $end microtime result from the end of the profiling * @return Profiler */ public function addProfile($start, $end) { $profile = new Profile(); $profile->start = MicroTime::fromString($start); $profile->end = MicroTime::fromString($end); array_push($this->profiles, $profile); return $this; }
private function diff() { return MicroTime::diff($this->end, $this->start); }
/** * Return a MicroTimeInterval representing the amount of time * elapsed between two MicroTime Objects * * @param \Dux\MicroTime $end * @param \Dux\MicroTime $start * @return \Dux\MicroTimeInterval */ public static function diff(MicroTime $end, MicroTime $start) { return new MicroTimeInterval($end->getSeconds() - $start->getSeconds(), $end->getMs() - $start->getMs()); }