mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
提高runtime的计算精度 避免吞吐率出现Division by zero错误
This commit is contained in:
@@ -53,8 +53,9 @@ class File
|
||||
} else {
|
||||
$current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
||||
}
|
||||
$runtime = number_format(microtime(true) - START_TIME, 6);
|
||||
$runtime = microtime(true) - START_TIME;
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$runtime = number_format($runtime, 6);
|
||||
$time_str = " [运行时间:{$runtime}s] [吞吐率:{$reqs}req/s]";
|
||||
$memory_use = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
$memory_str = " [内存消耗:{$memory_use}kb]";
|
||||
|
||||
@@ -41,8 +41,9 @@ class Sae
|
||||
} else {
|
||||
$current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
||||
}
|
||||
$runtime = number_format(microtime(true) - START_TIME, 6);
|
||||
$runtime = microtime(true) - START_TIME;
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$runtime = number_format($runtime, 6);
|
||||
$time_str = " [运行时间:{$runtime}s] [吞吐率:{$reqs}req/s]";
|
||||
$memory_use = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
$memory_str = " [内存消耗:{$memory_use}kb]";
|
||||
|
||||
@@ -59,8 +59,9 @@ class Socket
|
||||
if (!$this->check()) {
|
||||
return false;
|
||||
}
|
||||
$runtime = number_format(microtime(true) - START_TIME, 6);
|
||||
$runtime = microtime(true) - START_TIME;
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$runtime = number_format($runtime, 6);
|
||||
$time_str = " [运行时间:{$runtime}s][吞吐率:{$reqs}req/s]";
|
||||
$memory_use = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
$memory_str = " [内存消耗:{$memory_use}kb]";
|
||||
|
||||
@@ -43,8 +43,9 @@ class Trace
|
||||
return false;
|
||||
}
|
||||
// 获取基本信息
|
||||
$runtime = number_format(microtime(true) - START_TIME, 6);
|
||||
$runtime = microtime(true) - START_TIME;
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$runtime = number_format($runtime, 6);
|
||||
$mem = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
|
||||
// 页面Trace信息
|
||||
|
||||
Reference in New Issue
Block a user