name = $name; $this->stopwatch_event = $stopwatch_event; $this->description = $description; } /** * @return string */ public function get_name(): string { return $this->name; } /** * @return string */ public function get_description(): string { $duration = round( $this->stopwatch_event->getDuration() ); $memory = round( $this->stopwatch_event->getMemory() / 1024 / 1024, 2 ); $description = '' !== $this->description ? "
{$this->description}" : ''; return "{$this->name} – {$duration} ms – {$memory} MB{$description}"; } /** * @return float Timestamp of record start. */ public function get_origin(): float { return $this->stopwatch_event->getOrigin() / 1000; // ms to s. } /** * @return float Record duration in seconds. */ public function get_duration(): float { return $this->stopwatch_event->getDuration() / 1000; // ms to s. } /** * @return string */ public function get_category(): string { return $this->stopwatch_event->getCategory(); } }