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