mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进吞吐率计算
This commit is contained in:
@@ -13,7 +13,7 @@ namespace think;
|
||||
class Build
|
||||
{
|
||||
// 根据传入的build资料创建目录和文件
|
||||
public static function run($build = [])
|
||||
public static function run(array $build = [])
|
||||
{
|
||||
// 锁定
|
||||
$lockfile = APP_PATH . 'build.lock';
|
||||
|
||||
@@ -103,7 +103,7 @@ class Mysql extends Driver
|
||||
list($field, $name) = explode($key, '$.');
|
||||
$key = 'jsn_extract(' . $field . ', \'$.\'.' . $name . ')';
|
||||
}
|
||||
if (!preg_match('/[,\'\"\*\(\)`.\s]/', $key)) {
|
||||
if ($key && !preg_match('/[,\'\"\*\(\)`.\s]/', $key)) {
|
||||
$key = '`' . $key . '`';
|
||||
}
|
||||
return $key;
|
||||
|
||||
@@ -54,7 +54,7 @@ class File
|
||||
$current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
||||
}
|
||||
$runtime = microtime(true) - START_TIME;
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$reqs = number_format(1 / number_format($runtime, 8), 2);
|
||||
$runtime = number_format($runtime, 6);
|
||||
$time_str = " [运行时间:{$runtime}s] [吞吐率:{$reqs}req/s]";
|
||||
$memory_use = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
|
||||
@@ -42,7 +42,7 @@ class Sae
|
||||
$current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
||||
}
|
||||
$runtime = microtime(true) - START_TIME;
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$reqs = number_format(1 / number_format($runtime, 8), 2);
|
||||
$runtime = number_format($runtime, 6);
|
||||
$time_str = " [运行时间:{$runtime}s] [吞吐率:{$reqs}req/s]";
|
||||
$memory_use = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
|
||||
@@ -60,7 +60,7 @@ class Socket
|
||||
return false;
|
||||
}
|
||||
$runtime = microtime(true) - START_TIME;
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$reqs = number_format(1 / number_format($runtime, 8), 2);
|
||||
$runtime = number_format($runtime, 6);
|
||||
$time_str = " [运行时间:{$runtime}s][吞吐率:{$reqs}req/s]";
|
||||
$memory_use = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
|
||||
@@ -44,7 +44,7 @@ class Trace
|
||||
}
|
||||
// 获取基本信息
|
||||
$runtime = microtime(true) - START_TIME;
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$reqs = number_format(1 / number_format($runtime, 8), 2);
|
||||
$runtime = number_format($runtime, 6);
|
||||
$mem = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user