mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
trace日志驱动简化显示
This commit is contained in:
@@ -40,18 +40,16 @@ class Trace
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 获取基本信息
|
// 获取基本信息
|
||||||
$current_uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
|
||||||
$runtime = number_format(microtime(true) - START_TIME, 6);
|
$runtime = number_format(microtime(true) - START_TIME, 6);
|
||||||
$reqs = number_format(1 / $runtime, 2);
|
$reqs = number_format(1 / $runtime, 2);
|
||||||
|
$mem = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||||
|
|
||||||
// 页面Trace信息
|
// 页面Trace信息
|
||||||
$base = [
|
$base = [
|
||||||
'请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $current_uri,
|
'请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
|
||||||
'运行时间' => "{$runtime}s [ 吞吐率:{$reqs}req/s ]",
|
'运行时间' => "{$runtime}s [ 吞吐率:{$reqs}req/s ] 内存消耗:{$mem}kb 文件加载:" . count(get_included_files()),
|
||||||
'内存消耗' => number_format((memory_get_usage() - START_MEM) / 1024, 2) . 'kb',
|
|
||||||
'查询信息' => \think\Db::$queryTimes . ' queries ' . \think\Db::$executeTimes . ' writes ',
|
'查询信息' => \think\Db::$queryTimes . ' queries ' . \think\Db::$executeTimes . ' writes ',
|
||||||
'缓存信息' => \think\Cache::$readTimes . ' reads,' . \think\Cache::$writeTimes . ' writes',
|
'缓存信息' => \think\Cache::$readTimes . ' reads,' . \think\Cache::$writeTimes . ' writes',
|
||||||
'文件加载' => count(get_included_files()),
|
|
||||||
'配置加载' => count(\think\Config::get()),
|
'配置加载' => count(\think\Config::get()),
|
||||||
'会话信息' => 'SESSION_ID=' . session_id(),
|
'会话信息' => 'SESSION_ID=' . session_id(),
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user