Skip to content

Instantly share code, notes, and snippets.

@maxistar
Created May 15, 2014 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxistar/1196ac119bf8d1615f01 to your computer and use it in GitHub Desktop.
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
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