diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:39 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:40 +0400 |
commit | ae4b03163792f0b6e933933e5d37df87dc3fd566 (patch) | |
tree | d1d7510a9728f587d3d63ebd03e4ecf3d904838b /core/Timer.php | |
parent | 158c2150f5f2e13ece459b8d131244c11b763997 (diff) |
Mass conversion of all files to the newly agreed coding standard: PSR 1/2
Converting Piwik core source files, PHP, JS, TPL, CSS
More info: http://piwik.org/participate/coding-standards/
Diffstat (limited to 'core/Timer.php')
-rw-r--r-- | core/Timer.php | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/core/Timer.php b/core/Timer.php index 7e59cc674f..e747c6d3bd 100644 --- a/core/Timer.php +++ b/core/Timer.php @@ -1,66 +1,65 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package Piwik */ /** - * + * * @package Piwik */ class Piwik_Timer { - private $timerStart; - private $memoryStart; + private $timerStart; + private $memoryStart; - public function __construct() - { - $this->init(); - } + public function __construct() + { + $this->init(); + } - public function init() - { - $this->timerStart = $this->getMicrotime(); - $this->memoryStart = $this->getMemoryUsage(); - } + public function init() + { + $this->timerStart = $this->getMicrotime(); + $this->memoryStart = $this->getMemoryUsage(); + } - public function getTime($decimals = 3) - { - return number_format($this->getMicrotime() - $this->timerStart, $decimals, '.', ''); - } - - public function getTimeMs($decimals = 3) - { - return number_format(1000*($this->getMicrotime() - $this->timerStart), $decimals, '.', ''); - } + public function getTime($decimals = 3) + { + return number_format($this->getMicrotime() - $this->timerStart, $decimals, '.', ''); + } - public function getMemoryLeak() - { - return "Memory delta: ".Piwik::getPrettySizeFromBytes($this->getMemoryUsage() - $this->memoryStart); - } - - public function __toString() - { - return "Time elapsed: ". $this->getTime() ."s"; - } - - private function getMicrotime() - { - list($micro_seconds, $seconds) = explode(" ", microtime()); - return ((float)$micro_seconds + (float)$seconds); - } + public function getTimeMs($decimals = 3) + { + return number_format(1000 * ($this->getMicrotime() - $this->timerStart), $decimals, '.', ''); + } - private function getMemoryUsage() - { - if(function_exists('memory_get_usage')) - { - return memory_get_usage(); - } - return 0; - } + public function getMemoryLeak() + { + return "Memory delta: " . Piwik::getPrettySizeFromBytes($this->getMemoryUsage() - $this->memoryStart); + } + + public function __toString() + { + return "Time elapsed: " . $this->getTime() . "s"; + } + + private function getMicrotime() + { + list($micro_seconds, $seconds) = explode(" ", microtime()); + return ((float)$micro_seconds + (float)$seconds); + } + + private function getMemoryUsage() + { + if (function_exists('memory_get_usage')) { + return memory_get_usage(); + } + return 0; + } } |