Ejemplo n.º 1
0
 /**
  * A function not in the pinba extension api, needed to calculate total req. time
  */
 static function init($time = null)
 {
     if (self::$start == null || $time != null) {
         if ($time == null) {
             $time = microtime(true);
         }
         self::$start = $time;
     }
     if (self::$hostname == null) {
         self::$hostname = isset($_SERVER['HOST_NAME']) ? $_SERVER['HOST_NAME'] : gethostname();
     }
     if (self::$scriptName == null && isset($_SERVER['SCRIPT_NAME'])) {
         self::$scriptName = $_SERVER['SCRIPT_NAME'];
     }
     if (self::$serverName == null && isset($_SERVER['SERVER_NAME'])) {
         self::$serverName = $_SERVER['SERVER_NAME'];
     }
     if (!self::$shutdownRegistered) {
         self::$shutdownRegistered = true;
         register_shutdown_function('pinba::shutdownHandler');
     }
 }