本文整理汇总了PHP中XHProfRuns_Default::get_run方法的典型用法代码示例。如果您正苦于以下问题:PHP XHProfRuns_Default::get_run方法的具体用法?PHP XHProfRuns_Default::get_run怎么用?PHP XHProfRuns_Default::get_run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XHProfRuns_Default
的用法示例。
在下文中一共展示了XHProfRuns_Default::get_run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<?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: print_pct
<?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);
}