Back to Profiler class

Method mark

public string
mark
(mixed $label)
Output a time mark
Parameters
  • string $label A label for the time mark
Returns
  • string
Since
  • 1.7.0
Class: Profiler
Project: Joomla

Method mark - Source code

/**
 * Output a time mark
 *
 * @param   string  $label  A label for the time mark
 *
 * @return  string
 *
 * @since   1.7.0
 */
public function mark($label)
{
    $current = microtime(1) - $this->start;
    $currentMem = memory_get_usage() / 1048576;
    $m = (object) array('prefix' => $this->prefix, 'time' => ($current - $this->previousTime) * 1000, 'totalTime' => $current * 1000, 'memory' => $currentMem - $this->previousMem, 'totalMemory' => $currentMem, 'label' => $label);
    $this->marks[] = $m;
    $mark = sprintf('%s %.3f seconds (%.3f); %0.2f MB (%0.3f) - %s', $m->prefix, $m->totalTime / 1000, $m->time / 1000, $m->totalMemory, $m->memory, $m->label);
    $this->buffer[] = $mark;
    $this->previousTime = $current;
    $this->previousMem = $currentMem;
    return $mark;
}