Created
May 15, 2014 06:22
-
-
Save maxistar/1196ac119bf8d1615f01 to your computer and use it in GitHub Desktop.
Simple class to get the idea where is the bottlenecks on the code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Microtimer { | |
static $start; | |
static $count = 0; | |
static $activated = false; | |
static function init(){ | |
self::$start = microtime(true); | |
} | |
static function show($label=''){ | |
$stop = microtime(true); | |
print "*".(self::$count++).":".($stop-self::$start).":".$label."*"; | |
} | |
static function activateLevel($value){ | |
self::$activated = $value; | |
} | |
static function show1($label){ | |
if (self::$activated){ | |
self::show($label); | |
} | |
} | |
} | |
Microtimer::init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment