From e4c95efd80b4e4e1be10d04c0907e145e3344629 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 20 Nov 2020 08:44:00 +0000 Subject: [PATCH 1/2] Added minimal execution time for rendertime addon --- src/Util/Profiler.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Util/Profiler.php b/src/Util/Profiler.php index db3e1bb978..7bfc3c693a 100644 --- a/src/Util/Profiler.php +++ b/src/Util/Profiler.php @@ -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"; } } From cea2b1307554c9ddfddcc60e95f72e4c122431a7 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 20 Nov 2020 08:55:30 +0000 Subject: [PATCH 2/2] Parameter has to be float --- src/Util/Profiler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Util/Profiler.php b/src/Util/Profiler.php index 7bfc3c693a..5cc93e6815 100644 --- a/src/Util/Profiler.php +++ b/src/Util/Profiler.php @@ -165,11 +165,11 @@ class Profiler implements ContainerInterface /** * Returns the rendertime string - * @param int $limit Minimal limit for displaying the execution duration + * @param float $limit Minimal limit for displaying the execution duration * * @return string the rendertime */ - public function getRendertimeString(int $limit = 0) + public function getRendertimeString(float $limit = 0) { $output = '';