From 6071f8735f698f821093e5cb1438a00776333657 Mon Sep 17 00:00:00 2001 From: Axel Hahn <ax2002@gmx.net> Date: Mon, 10 Mar 2025 00:16:46 +0100 Subject: [PATCH] add timer on exec --- inc_functions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inc_functions.php b/inc_functions.php index 2c0dc83..21fdab7 100644 --- a/inc_functions.php +++ b/inc_functions.php @@ -67,18 +67,20 @@ function _exec($cmd): void { global $aCol; echo "$aCol[blue]cmd > $cmd$aCol[reset]\n"; + $iStart=microtime(true); exec("$cmd 2>&1", $aOut, $rc); - + $iEnd=microtime(true); if (!count($aOut)) { $aOut = ["-- no output --"]; } echo implode("\n", $aOut) . "\n"; + $sTime= "... ⏱️ Time: " . round($iEnd-$iStart, 3) . "s\n"; if ($rc != 0) { - echo "rc=$rc "; + echo "rc=$rc $sTime"; _abort("Error: Command failed. Aborting.", $rc); } - _ok(); + _ok($sTime); } function _mkdir(string $sMyDir): void -- GitLab