yii\log\Logger::getProfiling PHP Method

getProfiling() public method

By default, all profiling results will be returned. You may provide $categories and $excludeCategories as parameters to retrieve the results that you are interested in.
public getProfiling ( array $categories = [], array $excludeCategories = [] ) : array
$categories array list of categories that you are interested in. You can use an asterisk at the end of a category to do a prefix match. For example, 'yii\db\*' will match categories starting with 'yii\db\', such as 'yii\db\Connection'.
$excludeCategories array list of categories that you want to exclude
return array the profiling results. Each element is an array consisting of these elements: `info`, `category`, `timestamp`, `trace`, `level`, `duration`.
    public function getProfiling($categories = [], $excludeCategories = [])
    {
        $timings = $this->calculateTimings($this->messages);
        if (empty($categories) && empty($excludeCategories)) {
            return $timings;
        }
        foreach ($timings as $i => $timing) {
            $matched = empty($categories);
            foreach ($categories as $category) {
                $prefix = rtrim($category, '*');
                if (($timing['category'] === $category || $prefix !== $category) && strpos($timing['category'], $prefix) === 0) {
                    $matched = true;
                    break;
                }
            }
            if ($matched) {
                foreach ($excludeCategories as $category) {
                    $prefix = rtrim($category, '*');
                    foreach ($timings as $i => $timing) {
                        if (($timing['category'] === $category || $prefix !== $category) && strpos($timing['category'], $prefix) === 0) {
                            $matched = false;
                            break;
                        }
                    }
                }
            }
            if (!$matched) {
                unset($timings[$i]);
            }
        }
        return array_values($timings);
    }