Example #1
0
<?php

namespace ay\xhprof;

if (!isset($_GET['xhprof']['query']['request_id'], $_GET['xhprof']['query']['callee_id'])) {
    throw new \Exception('Missing required parameters.');
}
$request = $xhprof_data_obj->get($_GET['xhprof']['query']['request_id']);
if (!$request) {
    \ay\redirect(\ay\REDIRECT_REFERRER, 'Request data not found.');
}
$xhprof_obj = new Model($request);
$aggregated_family = $xhprof_obj->getFamily($_GET['xhprof']['query']['callee_id']);
if (!$aggregated_family) {
    throw new \Exception('Function is not in the callstack.');
}
$table_row = function ($e) use($request) {
    $e['metrics'] = format_metrics($e['metrics']);
    $e['metrics']['inclusive'] = format_metrics($e['metrics']['inclusive']);
    $e['metrics']['exclusive'] = format_metrics($e['metrics']['exclusive']);
    $e['metrics']['relative'] = array();
    foreach ($e['metrics']['inclusive'] as $name => $data) {
        $e['metrics']['relative'][$name] = format_number($request['total'][$name] == 0 ? 0 : $e['metrics']['inclusive'][$name]['raw'] * 100 / $request['total'][$name]);
    }
    ?>
	<tr<?php 
    if ($e['internal']) {
        ?>
 class="internal"<?php 
    }
    ?>