mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
START_TIME START_MEM 更改为 THINK_START_TIME THINK_START_MEM
This commit is contained in:
6
base.php
6
base.php
@@ -9,9 +9,9 @@
|
|||||||
// | Author: liu21st <liu21st@gmail.com>
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
define('THINK_VERSION', '5.0.0 RC3');
|
define('THINK_VERSION', '5.0.0 RC4');
|
||||||
define('START_TIME', number_format(microtime(true), 8, '.', ''));
|
define('THINK_START_TIME', number_format(microtime(true), 8, '.', ''));
|
||||||
define('START_MEM', memory_get_usage());
|
define('THINK_START_MEM', memory_get_usage());
|
||||||
define('EXT', '.php');
|
define('EXT', '.php');
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
defined('THINK_PATH') or define('THINK_PATH', __DIR__ . DS);
|
defined('THINK_PATH') or define('THINK_PATH', __DIR__ . DS);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Debug
|
|||||||
*/
|
*/
|
||||||
public static function getUseTime($dec = 6)
|
public static function getUseTime($dec = 6)
|
||||||
{
|
{
|
||||||
return number_format((microtime(true) - START_TIME), $dec);
|
return number_format((microtime(true) - THINK_START_TIME), $dec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ class Console
|
|||||||
public function output(array $log = [])
|
public function output(array $log = [])
|
||||||
{
|
{
|
||||||
// 获取基本信息
|
// 获取基本信息
|
||||||
$runtime = number_format(microtime(true), 8, '.', '') - START_TIME;
|
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
||||||
$reqs = number_format(1 / $runtime, 2);
|
$reqs = number_format(1 / $runtime, 2);
|
||||||
$mem = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
$mem = number_format((memory_get_usage() - THINK_START_MEM) / 1024, 2);
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_HOST'])) {
|
if (isset($_SERVER['HTTP_HOST'])) {
|
||||||
$uri = $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
$uri = $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ class Html
|
|||||||
{
|
{
|
||||||
|
|
||||||
// 获取基本信息
|
// 获取基本信息
|
||||||
$runtime = number_format(microtime(true), 8, '.', '') - START_TIME;
|
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
||||||
$reqs = number_format(1 / $runtime, 2);
|
$reqs = number_format(1 / $runtime, 2);
|
||||||
$mem = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
$mem = number_format((memory_get_usage() - THINK_START_MEM) / 1024, 2);
|
||||||
|
|
||||||
// 页面Trace信息
|
// 页面Trace信息
|
||||||
if (isset($_SERVER['HTTP_HOST'])) {
|
if (isset($_SERVER['HTTP_HOST'])) {
|
||||||
|
|||||||
@@ -65,10 +65,10 @@ class Socket
|
|||||||
if (!$this->check()) {
|
if (!$this->check()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$runtime = number_format(microtime(true), 8, '.', '') - START_TIME;
|
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
||||||
$reqs = number_format(1 / number_format($runtime, 8), 2);
|
$reqs = number_format(1 / number_format($runtime, 8), 2);
|
||||||
$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() - THINK_START_MEM) / 1024, 2);
|
||||||
$memory_str = " [内存消耗:{$memory_use}kb]";
|
$memory_str = " [内存消耗:{$memory_use}kb]";
|
||||||
$file_load = " [文件加载:" . count(get_included_files()) . "]";
|
$file_load = " [文件加载:" . count(get_included_files()) . "]";
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ class File
|
|||||||
} else {
|
} else {
|
||||||
$current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
$current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
||||||
}
|
}
|
||||||
$runtime = number_format(microtime(true), 8, '.', '') - START_TIME;
|
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
||||||
$reqs = number_format(1 / $runtime, 2);
|
$reqs = number_format(1 / $runtime, 2);
|
||||||
$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() - THINK_START_MEM) / 1024, 2);
|
||||||
$memory_str = " [内存消耗:{$memory_use}kb]";
|
$memory_str = " [内存消耗:{$memory_use}kb]";
|
||||||
$file_load = " [文件加载:" . count(get_included_files()) . "]";
|
$file_load = " [文件加载:" . count(get_included_files()) . "]";
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ class Sae
|
|||||||
} else {
|
} else {
|
||||||
$current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
$current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
||||||
}
|
}
|
||||||
$runtime = number_format(microtime(true), 8, '.', '') - START_TIME;
|
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
||||||
$reqs = number_format(1 / $runtime, 2);
|
$reqs = number_format(1 / $runtime, 2);
|
||||||
$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() - THINK_START_MEM) / 1024, 2);
|
||||||
$memory_str = " [内存消耗:{$memory_use}kb]";
|
$memory_str = " [内存消耗:{$memory_use}kb]";
|
||||||
$file_load = " [文件加载:" . count(get_included_files()) . "]";
|
$file_load = " [文件加载:" . count(get_included_files()) . "]";
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ class baseTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function testConstants()
|
public function testConstants()
|
||||||
{
|
{
|
||||||
$this->assertNotEmpty(START_TIME);
|
$this->assertNotEmpty(THINK_START_TIME);
|
||||||
$this->assertNotEmpty(START_MEM);
|
$this->assertNotEmpty(THINK_START_MEM);
|
||||||
$this->assertNotEmpty(THINK_VERSION);
|
$this->assertNotEmpty(THINK_VERSION);
|
||||||
$this->assertNotEmpty(DS);
|
$this->assertNotEmpty(DS);
|
||||||
$this->assertNotEmpty(THINK_PATH);
|
$this->assertNotEmpty(THINK_PATH);
|
||||||
|
|||||||
Reference in New Issue
Block a user