php查看运行时间、内存消耗
2013-04-11 10:34
423 查看
<?php /*计算运行时间*/ 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); } /*格式化当前内存消耗*/ function memory(){ $size = memory_get_usage(); $unit = array('b','kb','mb','gb','tb','pb'); return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; } } ?>
相关文章推荐
- php查看运行时间、内存消耗
- 使用memory_profiler 与 cProfile ,line_profiler 优化Python程序运行时间和内存消耗实例
- php计算代码运行时间与内存使用的一段代码
- php 获取代码执行时间和消耗的内存
- php测试程序运行时间和占用内存情况
- 设置内存限制和运行时间,php回调函数
- php 代码运行时间查看类
- VC6.0下怎样查看程序的运行时间及内存占用情况
- php 获取代码执行时间和消耗的内存
- php 代码运行时间查看类
- php代码运行时间查看类代码分享
- 多核优化,使用linux affinity 将进程,线程,中断指定到对应的cpu运行,用ftrace查看消耗时间
- 最简单的记录程序运行时间的方法:[记录PHP程序运行消耗时间]
- php 类静态变量 和 常量消耗内存及时间对比
- 查看php脚本当前的内存消耗情况
- 88、展示Tensorflow计算图上每个节点的基本信息以及运行时消耗的时间和空间
- 查看mysql语句运行时间
- php计算程序运行时间
- iOS之查看代码运行的时间