Generate callstack value from inside Profiler::saveTimestamp
- Save a massive amount of time computing callstacks when profiling is disabled
This commit is contained in:
parent
19141b1bcf
commit
afb882048e
13 changed files with 42 additions and 39 deletions
|
@ -23,6 +23,7 @@ namespace Friendica\Util;
|
|||
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\System;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
@ -88,9 +89,9 @@ class Profiler implements ContainerInterface
|
|||
* Saves a timestamp for a value - f.e. a call
|
||||
* Necessary for profiling Friendica
|
||||
*
|
||||
* @param int $timestamp the Timestamp
|
||||
* @param string $value A value to profile
|
||||
* @param string $callstack The callstack of the current profiling data
|
||||
* @param int $timestamp the Timestamp
|
||||
* @param string $value A value to profile
|
||||
* @param string $callstack A callstack string, generated if absent
|
||||
*/
|
||||
public function saveTimestamp($timestamp, $value, $callstack = '')
|
||||
{
|
||||
|
@ -98,6 +99,8 @@ class Profiler implements ContainerInterface
|
|||
return;
|
||||
}
|
||||
|
||||
$callstack = $callstack ?: System::callstack(4, 1);
|
||||
|
||||
$duration = floatval(microtime(true) - $timestamp);
|
||||
|
||||
if (!isset($this->performance[$value])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue