首页 > 其他 > 详细

对于脚本语言的执行时间计算

时间:2014-09-05 15:57:01      阅读:121      评论:0      收藏:0      [点我收藏+]
class runtime
{
var $StartTime = 0;
var $StopTime = 0;

function get_microtime()
{
list($usec, $sec) = explode(‘ ‘, microtime());
return ((float)$usec + (float)$sec);
}

function start()
{
$this->StartTime = $this->get_microtime();
}

function stop()
{
$this->StopTime = $this->get_microtime();
}

function spent()
{
return round(($this->StopTime - $this->StartTime) * 1000, 1);
}

}
$run_time = new runtime();
$run_time->start();
//begin your code
//end your code
$run_time->stop();
echo "Script running time:".$run_time->spent()."ms";

  

对于脚本语言的执行时间计算

原文:http://www.cnblogs.com/jiechn/p/3958090.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!