简体   繁体   English

代码点火器中的基准测试

[英]Benchmarking in Code Igniter

CodeIgniter has a Benchmarking class that is always active, enabling the time difference between any two marked points to be calculated. CodeIgniter具有一个始终处于活动状态的Benchmarking类,可以计算任意两个标记点之间的时间差。

If you want to measure time difference between two points, you simply add the following code: 如果要测量两点之间的时差,只需添加以下代码:

$this->benchmark->mark('code_start');

// Some code happens here

$this->benchmark->mark('code_end');

echo $this->benchmark->elapsed_time('code_start', 'code_end');

But what result function elapsed_time is returning, seconds, milliseconds or some other unit? 但是,返回的结果函数elapsed_time是几秒,毫秒还是其他单位?

it returns a float number represent seconds, "0.654" = 0 sec, and 654 ms. 它返回一个浮点数,表示秒,“ 0.654” = 0秒和654毫秒。 etc 等等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM