From 1e5f13b21b33b0d7ce86fe97ca145a3561433a7a Mon Sep 17 00:00:00 2001 From: wei <> Date: Mon, 18 Sep 2006 22:57:16 +0000 Subject: Add an interactive php shell that loads Prado classes. --- .../PHP/Shell/Extensions/ExecutionTime.php | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 framework/3rdParty/PhpShell/PHP/Shell/Extensions/ExecutionTime.php (limited to 'framework/3rdParty/PhpShell/PHP/Shell/Extensions/ExecutionTime.php') diff --git a/framework/3rdParty/PhpShell/PHP/Shell/Extensions/ExecutionTime.php b/framework/3rdParty/PhpShell/PHP/Shell/Extensions/ExecutionTime.php new file mode 100644 index 00000000..2c2bf9ad --- /dev/null +++ b/framework/3rdParty/PhpShell/PHP/Shell/Extensions/ExecutionTime.php @@ -0,0 +1,56 @@ +registerOption("exectime", $this, "optSetExecTime"); + } + + public function optSetExecTime($key, $val) { + switch ($val) { + case "enable": + case "1": + case "on": + $this->show_exectime = true; + break; + case "disable": + case "0": + case "off": + $this->show_exectime = false; + break; + default: + printf(":set %s failed, unknown value. Use :set %s = (on|off)", $key, $key); + break; + } + } + + public function startParseTime() { + $this->parse_time = microtime(1); + $this->exec_time = 0.0; + } + public function startExecTime() { + $this->exec_time = microtime(1); + } + public function stopTime() { + $this->end_time = microtime(1); + } + + public function getParseTime() { + return ($this->exec_time == 0.0 ? $this->end_time : $this->exec_time) - $this->parse_time; + } + + public function getExecTime() { + return ($this->exec_time == 0.0 ? 0.0 : $this->end_time - $this->exec_time); + } + + public function isShow() { + return $this->show_exectime; + } +} -- cgit v1.2.3