Example #1
0
function xhprof_shutdown()
{
    global $xhprofMainConfig;
    $xhprof_data = xhprof_disable();
    if (function_exists('fastcgi_finish_request')) {
        fastcgi_finish_request();
    }
    try {
        require_once __DIR__ . '/../xhprof/classes/data.php';
        $xhprof_data_obj = new \ay\xhprof\Data($xhprofMainConfig['pdo']);
        $xhprof_data_obj->save($xhprof_data);
    } catch (Exception $e) {
        // old php versions don't like Exceptions in shutdown functions
        // -> log them to have some usefull info in the php-log
        if (PHP_VERSION_ID < 504000) {
            if (function_exists('log_exception')) {
                log_exception($e);
            } else {
                error_log($e->__toString());
            }
        }
        // re-throw to show the caller something went wrong
        throw $e;
    }
}
 /**
  * Stop profiling session
  *
  * @return void
  */
 public function stop()
 {
     if (!$this->started) {
         return;
     }
     $xhprof_data = xhprof_disable();
     require_once self::$xhprof_path . "/xhprof/classes/data.php";
     $xhprof_data_obj = new \ay\xhprof\Data(self::$config['pdo']);
     $xhprof_data_obj->save($xhprof_data);
 }
Example #3
0
<?php

// CLI environment is currently not supported
if (php_sapi_name() == 'cli') {
    return;
}
register_shutdown_function(function () {
    // by registering register_shutdown_function at the end of the file
    // I make sure that all execution data, including that of the earlier
    // registered register_shutdown_function, is collected.
    $xhprof_data = xhprof_disable();
    if (function_exists('fastcgi_finish_request')) {
        fastcgi_finish_request();
    }
    $config = (require __DIR__ . '/../xhprof/includes/config.inc.php');
    require_once __DIR__ . '/../xhprof/classes/data.php';
    $xhprof_data_obj = new \ay\xhprof\Data($config['pdo']);
    $xhprof_data_obj->save($xhprof_data);
});
Example #4
0
 /**
  * xhprof.io data storage
  *
  * @param array $settings
  * @return void
  */
 protected function saveToXhprofio(array $settings)
 {
     require_once __DIR__ . '/../../../../../Resources/Private/Xhprof.io/data.php';
     $pdo = new \PDO($settings['xhprof.io']['dsn'], $settings['xhprof.io']['username'], $settings['xhprof.io']['password']);
     $xhprofData = new \ay\xhprof\Data($pdo);
     $xhprofData->save($this->xhprofTrace);
 }