From 53e769b007bd8a60d77904ac982f9c5614a7fd4c Mon Sep 17 00:00:00 2001 From: ArrayIterator Date: Sun, 15 Oct 2023 03:39:32 +0700 Subject: [PATCH] add application rendering duration --- src/Benchmark/Waterfall.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Benchmark/Waterfall.php b/src/Benchmark/Waterfall.php index 54d0942..89e2e10 100644 --- a/src/Benchmark/Waterfall.php +++ b/src/Benchmark/Waterfall.php @@ -198,6 +198,12 @@ private function closeTag(string $tag = 'div') : string */ public function createHtmlStructure(bool $showEmpty = false) : string { + $microtimeStart = $_SERVER['REQUEST_TIME_FLOAT'] + ??$this->getProfiler()->getStartTime(); + $firstRender = $this->getProfiler()->convertMicrotime( + microtime(true) - $microtimeStart + ); + $memory_get_usage = memory_get_usage(); $memory_get_real_usage = memory_get_usage(true); $memory_get_peak_usage = memory_get_peak_usage(); @@ -387,6 +393,19 @@ public function createHtmlStructure(bool $showEmpty = false) : string ), round($profilerDurations, 2) . ' ms', true + ) . $this->createOpenTag( + 'span', + $this->appendAttributeClass( + [ + //'severity-info', + 'info' + ], + [ + 'title' => 'Application rendering duration' + ] + ), + round($firstRender, 2) . ' ms', + true ), true, false