Exemplo n.º 1
0
 /**
  * @copyright http://anton.shevchuk.name/php/debug-zend-framework-application-with-firephp/
  * @static
  */
 public static function timeStamp($comment = "")
 {
     if (!self::$_timer instanceof Zend_Wildfire_Plugin_FirePhp_TableMessage) {
         self::$_timer = new Zend_Wildfire_Plugin_FirePhp_TableMessage('Timer');
         self::$_timer->setBuffered(true);
         self::$_timer->setHeader(array('Time (sec)', 'Total (sec)', 'Memory (Kb)', 'Total (Kb)', 'Comment', 'File'));
         self::$_timer->setOption('includeLineNumbers', false);
     }
     $back = debug_backtrace();
     list($msec, $sec) = explode(chr(32), microtime());
     list($mTotal, $mSec) = self::getMemoryUsage();
     if (!isset(self::$_time)) {
         self::$_time["start"] = $sec + $msec;
         self::$_time["section"] = $sec + $msec;
         self::$_timer->addRow(array(sprintf("%01.4f", 0), sprintf("%01.4f", 0), $mSec, $mTotal, $comment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
     } else {
         $start = self::$_time["section"];
         self::$_time["section"] = $sec + $msec;
         self::$_timer->addRow(array(sprintf("%01.4f", round(self::$_time["section"] - $start, 4)), sprintf("%01.4f", round(self::$_time["section"] - self::$_time["start"], 4)), $mSec, $mTotal, $comment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
     }
     self::updateMessageLabel();
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send(self::$_timer);
 }