zoukankan      html  css  js  c++  java
  • PHP 速度测试函数

    1. function ss_timing_start ($name = default) { 
    2.  global $ss_timing_start_times
    3.  $ss_timing_start_times[$name] = explode( , microtime()); 
    4. function ss_timing_stop ($name = default) { 
    5.  global $ss_timing_stop_times
    6.  $ss_timing_stop_times[$name] = explode(, microtime()); 
    7. function ss_timing_current ($name = default) { 
    8.  global $ss_timing_start_times$ss_timing_stop_times
    9.  if (!isset($ss_timing_start_times[$name])) { 
    10. return 0; 
    11.  } 
    12.  if (!isset($ss_timing_stop_times[$name])) { 
    13. $stop_time = explode(, microtime()); 
    14.  } 
    15.  else { 
    16. $stop_time = $ss_timing_stop_times[$name]; 
    17.  } 
    18.  $current = $stop_time[1] - $ss_timing_start_times[$name][1]; 
    19.  $current += $stop_time[0] - $ss_timing_start_times[$name][0]; 
    20.  return $current
    21. 现在可以轻松地检查任何一段代码的执行时间了,甚至我们可以同时使用多个计时器,只需在使用上述的几个函数时设定不同的参数作为计时器的名称就可以了。

     

  • 相关阅读:
    如何获取下拉框中的值
    如何建立主从服务器
    hibernate
    Python基础(一)
    python2 与 python3 区别
    canvas简述(二)游戏实战思路
    canvas简述(一)
    C简述(二)
    C语言的基本简述
    Js基础(三) WebAPI
  • 原文地址:https://www.cnblogs.com/cnsanshao/p/2041678.html
Copyright © 2011-2022 走看看