get_run() 공개 메소드

Retreives a run from the database,
public get_run ( string $run_id, mixed $type, mixed &$run_desc ) : mixed
$run_id string unique identifier for the run being requested
$type mixed
$run_desc mixed
리턴 mixed
예제 #1
0
<?php

// Setup parameters
$key = $_SERVER['argv'][1];
$run = $_SERVER['argv'][2];
$source = isset($_SERVER['argv'][3]) ? $_SERVER['argv'][3] : 'drupal-perf';
// Retrieve run data
include_once dirname(__FILE__) . '/xhprof/xhprof_lib/utils/xhprof_lib.php';
include_once dirname(__FILE__) . '/xhprof/xhprof_lib/utils/xhprof_runs.php';
include_once dirname(__FILE__) . '/xhprof/xhprof_lib/display/xhprof.php';
$xhprof_runs_impl = new XHProfRuns_Default();
$run_data = $xhprof_runs_impl->get_run($run, $source, $description);
// Save run data ...
$data = serialize($run_data);
$tmp = tmpfile();
fwrite($tmp, $data);
fseek($tmp, 0);
// ... and upload.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.lionsad.de/xhprof-kit/hosted/upload.php?key={$key}&run={$run}&source={$source}");
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $tmp);
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($data));
$result = curl_exec($ch);
curl_close($ch);
// Then cleanup.
fclose($tmp);
예제 #2
0
<?php

$run1 = $_SERVER['argv'][1];
$run2 = $_SERVER['argv'][2];
$extra = isset($_SERVER['argv'][3]) ? $_SERVER['argv'][3] : '';
$source = isset($_SERVER['argv'][4]) ? $_SERVER['argv'][4] : 'drupal-perf';
include_once dirname(__FILE__) . '/xhprof/xhprof_lib/utils/xhprof_lib.php';
include_once dirname(__FILE__) . '/xhprof/xhprof_lib/utils/xhprof_runs.php';
include_once dirname(__FILE__) . '/xhprof/xhprof_lib/display/xhprof.php';
$xhprof_runs_impl = new XHProfRuns_Default();
$run1_data = $xhprof_runs_impl->get_run($run1, $source, $description1);
$run2_data = $xhprof_runs_impl->get_run($run2, $source, $description2);
$run_delta = xhprof_compute_diff($run1_data, $run2_data);
$symbol_tab = xhprof_compute_flat_info($run_delta, $totals);
$symbol_tab1 = xhprof_compute_flat_info($run1_data, $totals_1);
$symbol_tab2 = xhprof_compute_flat_info($run2_data, $totals_2);
$metrics = xhprof_get_metrics($run_delta);
function print_pct($numer, $denom)
{
    if ($denom == 0) {
        $pct = "N/A%";
    } else {
        $pct = xhprof_percent_format($numer / abs($denom));
    }
    return $pct;
}
function print_num($num, $fmt_func = null)
{
    if (!empty($fmt_func)) {
        $num = call_user_func($fmt_func, $num);
    }