getTimers example

protected $title = 'Timers';

    /** * Child classes should implement this to return the timeline data * formatted for correct usage. */
    protected function formatTimelineData(): array
    {
        $data = [];

        $benchmark = Services::timer(true);
        $rows      = $benchmark->getTimers(6);

        foreach ($rows as $name => $info) {
            if ($name === 'total_execution') {
                continue;
            }

            $data[] = [
                'name'      => ucwords(str_replace('_', ' ', $name)),
                'component' => 'Timer',
                'start'     => $info['start'],
                'duration'  => $info['end'] - $info['start'],
            ];
Home | Imprint | This part of the site doesn't use cookies.