home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / stopwatch.inc < prev    next >
Encoding:
Text File  |  2003-03-16  |  573 b   |  29 lines

  1. <?php
  2.  
  3. class stopwatch{
  4.     var $entries;
  5.     
  6.     function stopwatch(){
  7.         $this->entries = array();
  8.     }
  9.     
  10.     function register($message){
  11.         $entry_a["time"] = microtime();
  12.         $entry_a["message"] = $message;
  13.         array_push($this->entries, $entry_a);
  14.     }
  15.     
  16.     function dump(){
  17.         reset($this->entries);
  18.         while ( list($k, $blah) = each($this->entries) ){
  19.             $a = $this->entries[$k];
  20.             $str = $a["time"];
  21.             $space_pos = strpos($str, " ");
  22.             $seconds = substr($str, $space_pos+1);
  23.             $microsec = substr($str, 1, $space_pos - 2);
  24.             echo $seconds.$microsec.":".$a["message"]."\n";
  25.         }
  26.     }
  27. }
  28.  
  29. ?>