]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Profiler.php
Merge pull request #9186 from annando/valid-posts
[friendica.git] / src / Util / Profiler.php
index 240273bde3ce319594cbe4c6a4adc7de6dcada33..db3e1bb97825f38f4d48cab62170377e54dc4f6b 100644 (file)
@@ -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])) {