Пример #1
0
 /**
  * Singleton Pattern.
  * Allows for reusing the initial instanited object.
  */
 public static function obtain()
 {
     if (!self::$instance) {
         self::$instance = new debug();
     }
     return self::$instance;
 }
Пример #2
0
 function accumulator_stop($key)
 {
     if (!debug::is_debug_enabled()) {
         return;
     }
     $debug =& debug::instance();
     $stop_time = $debug->_time_to_float(microtime());
     if (!array_key_exists($key, $debug->time_accumulator_list)) {
         debug::write_warning('Accumulator $key does not exists, run debug::accumulator_start first', 'debug::accumulator_stop');
         return;
     }
     $accumulator =& $debug->time_accumulator_list[$key];
     $diffTime = $stop_time - $accumulator['temp_time'];
     $accumulator['time'] = $accumulator['time'] + $diffTime;
     ++$accumulator['count'];
 }