[ Index ] |
|
Code source de PRADO 3.0.6 |
1 <?php 2 3 class PHP_Shell_Extensions_ExecutionTime implements PHP_Shell_Extension { 4 protected $show_exectime = false; 5 6 protected $parse_time; 7 protected $exec_time; 8 protected $end_time; 9 10 public function register() { 11 $opt = PHP_Shell_Options::getInstance(); 12 13 $opt->registerOption("exectime", $this, "optSetExecTime"); 14 } 15 16 public function optSetExecTime($key, $val) { 17 switch ($val) { 18 case "enable": 19 case "1": 20 case "on": 21 $this->show_exectime = true; 22 break; 23 case "disable": 24 case "0": 25 case "off": 26 $this->show_exectime = false; 27 break; 28 default: 29 printf(":set %s failed, unknown value. Use :set %s = (on|off)", $key, $key); 30 break; 31 } 32 } 33 34 public function startParseTime() { 35 $this->parse_time = microtime(1); 36 $this->exec_time = 0.0; 37 } 38 public function startExecTime() { 39 $this->exec_time = microtime(1); 40 } 41 public function stopTime() { 42 $this->end_time = microtime(1); 43 } 44 45 public function getParseTime() { 46 return ($this->exec_time == 0.0 ? $this->end_time : $this->exec_time) - $this->parse_time; 47 } 48 49 public function getExecTime() { 50 return ($this->exec_time == 0.0 ? 0.0 : $this->end_time - $this->exec_time); 51 } 52 53 public function isShow() { 54 return $this->show_exectime; 55 } 56 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |