<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
{
$this->performance = [];
$this->performance['start'] = microtime(true);
+ $this->performance['ready'] = 0;
$this->performance['database'] = 0;
$this->performance['database_write'] = 0;
$this->performance['cache'] = 0;
$this->performance['parser'] = 0;
$this->performance['marktime'] = 0;
$this->performance['marktime'] = microtime(true);
+ $this->performance['classcreate'] = 0;
+ $this->performance['classinit'] = 0;
+ $this->performance['init'] = 0;
+ $this->performance['content'] = 0;
}
/**
/**
* Returns the rendertime string
+ * @param float $limit Minimal limit for displaying the execution duration
*
* @return string the rendertime
*/
- public function getRendertimeString()
+ public function getRendertimeString(float $limit = 0)
{
$output = '';
$output .= "\nDatabase Read:\n";
foreach ($this->callstack["database"] as $func => $time) {
$time = round($time, 3);
- if ($time > 0) {
+ if ($time > $limit) {
$output .= $func . ": " . $time . "\n";
}
}
$output .= "\nDatabase Write:\n";
foreach ($this->callstack["database_write"] as $func => $time) {
$time = round($time, 3);
- if ($time > 0) {
+ if ($time > $limit) {
$output .= $func . ": " . $time . "\n";
}
}
$output .= "\nCache Read:\n";
foreach ($this->callstack["cache"] as $func => $time) {
$time = round($time, 3);
- if ($time > 0) {
+ if ($time > $limit) {
$output .= $func . ": " . $time . "\n";
}
}
$output .= "\nCache Write:\n";
foreach ($this->callstack["cache_write"] as $func => $time) {
$time = round($time, 3);
- if ($time > 0) {
+ if ($time > $limit) {
$output .= $func . ": " . $time . "\n";
}
}
$output .= "\nNetwork:\n";
foreach ($this->callstack["network"] as $func => $time) {
$time = round($time, 3);
- if ($time > 0) {
+ if ($time > $limit) {
$output .= $func . ": " . $time . "\n";
}
}
}
}
+ public function set($timestamp, $id)
+ {
+ $this->performance[$id] = $timestamp;
+ }
+
/**
* Returns true if the container can return an entry for the given identifier.
* Returns false otherwise.