+ helper: add function to compute and display time consuming between 2 endpoints.

This commit is contained in:
liugang
2023-08-10 10:03:26 +08:00
parent ee9f090a0d
commit 64def76b06
+25
View File
@@ -390,6 +390,31 @@ function formatTime($time, $format = '')
return trim($time);
}
/**
* Display time consuming.
*
* @param string $tag
* @access public
* @return void
*/
function t($tag = '')
{
global $last;
$time = microtime();
if($last)
{
list($lms, $ls) = explode(' ', $last);
list($ms, $s) = explode(' ', $time);
a("$tag: time consuming=" . ($s - $ls + round($ms - $lms, 3)) . 's');
}
else
{
a("$tag: current time={$time}");
}
$last = $time;
}
/**
* Fix for session error.
*