]> git.mxchange.org Git - friendica.git/commitdiff
Added minimal execution time for rendertime addon
authorMichael <heluecht@pirati.ca>
Fri, 20 Nov 2020 08:44:00 +0000 (08:44 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 20 Nov 2020 08:44:00 +0000 (08:44 +0000)
src/Util/Profiler.php

index db3e1bb97825f38f4d48cab62170377e54dc4f6b..7bfc3c693ab945801adc36bd4583a2b33d48715d 100644 (file)
@@ -165,10 +165,11 @@ class Profiler implements ContainerInterface
 
        /**
         * Returns the rendertime string
+        * @param int $limit Minimal limit for displaying the execution duration
         *
         * @return string the rendertime
         */
-       public function getRendertimeString()
+       public function getRendertimeString(int $limit = 0)
        {
                $output = '';
 
@@ -180,7 +181,7 @@ class Profiler implements ContainerInterface
                        $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";
                                }
                        }
@@ -189,7 +190,7 @@ class Profiler implements ContainerInterface
                        $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";
                                }
                        }
@@ -198,7 +199,7 @@ class Profiler implements ContainerInterface
                        $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";
                                }
                        }
@@ -207,7 +208,7 @@ class Profiler implements ContainerInterface
                        $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";
                                }
                        }
@@ -216,7 +217,7 @@ class Profiler implements ContainerInterface
                        $output .= "\nNetwork:\n";
                        foreach ($this->callstack["network"] as $func => $time) {
                                $time = round($time, 3);
-                               if ($time > 0) {
+                               if ($time > $limit) {
                                        $output .= $func . ": " . $time . "\n";
                                }
                        }