http://www.csdn.net/expert/topic/982/982294.xml?temp=2.750796E-02
里面有一个计算速度的.你看看吧.

解决方案 »

  1.   

    class timer
    {
      var $StartTime = 0;
      var $StopTime = 0;
      var $TimeSpent = 0;  function start()
      {
        $this->StartTime = microtime();
      }
      function stop()
      {
        $this->StopTime = microtime();
      }
      function spent()
      {
        if ($this->TimeSpent)
        {
          return $this->TimeSpent;
        }
        else
        {
          $StartMicro = substr($this->StartTime,0,10);
          $StartSecond = substr($this->StartTime,11,10);
          $StopMicro = substr($this->StopTime,0,10);
          $StopSecond = substr($this->StopTime,11,10);
          $start = doubleval($StartMicro) + $StartSecond;
          $stop = doubleval($StopMicro) + $StopSecond;
          $this->TimeSpent = $stop - $start;
          return substr($this->TimeSpent,0,8);
        }
      } // end function spent();
    } //end class timer;
    $timer = new timer;
    $timer->start();
    $timer->stop();
    echo "运行时间花了".$timer->spent()."秒<br>";