public function stopAvg($block)
    {
        if ($this->enabled) {
            if (!isset($this->avgs[$block])) {
                throw new \Exception('Average block '.$block.' has not been started!');
            }

            $this->avgs[$block]['stop'] = microtime(true);
            if (!isset($this->avgs[$block]['stop-line'])) {
                $this->avgs[$block]['stop-line'] = $this->getLineNumber();
            }

            // Calculate average
            $this->avgs[$block]['count']++; // increment count

            $time = $this->avgs[$block]['stop'] - $this->avgs[$block]['start'];

            // Check max and min time
            if ($this->avgs[$block]['max-time'] < $time) {
                $this->avgs[$block]['max-time'] = $time;
            }
            if ($this->avgs[$block]['min-time'] > $time) {
                $this->avgs[$block]['min-time'] = $time;
            }

            $this->avgs[$block]['total'] = $this->avgs[$block]['total'] + $time;
        }
    }