From 4080f4d0836898eb0025e435d9fdf2d2ab3f60bb Mon Sep 17 00:00:00 2001 From: Adrian Jones Date: Sun, 11 Feb 2024 08:03:02 -0800 Subject: [PATCH] Add execution time to Enable Tracy button tooltip. --- TracyDebugger.module.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/TracyDebugger.module.php b/TracyDebugger.module.php index baa41a4..f8c0a7d 100644 --- a/TracyDebugger.module.php +++ b/TracyDebugger.module.php @@ -27,7 +27,7 @@ public static function getModuleInfo() { 'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__), 'author' => 'Adrian Jones', 'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/', - 'version' => '4.25.14', + 'version' => '4.25.15', 'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first 'singular' => true, 'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4', @@ -46,6 +46,7 @@ public static function getModuleInfo() { const COLOR_ALERT = '#cd1818'; protected $data = array(); + protected $time; protected $httpReferer; protected $tracyEnabled = false; protected $earlyExit = false; @@ -333,6 +334,8 @@ public function __construct() { */ public function init() { + $this->time = $_SERVER['REQUEST_TIME_FLOAT'] ?? microtime(true); + if(class_exists('\Tracy\Debugger', false) && Debugger::isEnabled()) return; // load Tracy files and our helper files @@ -1890,6 +1893,8 @@ protected function addUserBar($event) { */ protected function addEnableButton($event) { + $execution_time_tooltip = "Execution Time: ".number_format((microtime(true) - $this->time) * 1000, 1, '.', "\u{202f}")." ms"; + // DON'T add comments to injected code below because it breaks my simple minify() function // if Tracy temporarily toggled disabled, add enable icon link $enableButton = ' @@ -1916,7 +1921,7 @@ function enableTracy() { location.reload(); } -
+