function xhprof_print_flat_data in XHProf 6
Same name and namespace in other branches
- 7 xhprof.inc \xhprof_print_flat_data()
Print non-hierarchical (flat-view) of profiler data.
@author Kannan
File
- ./
xhprof.inc, line 806
Code
function xhprof_print_flat_data($url_params, $title, $flat_data, $sort, $run1, $run2, $limit) {
global $stats;
global $pc_stats;
global $totals;
global $vwbar;
global $base_path;
$output = '';
// Table attributes
$attributes = array(
'id' => 'xhprof-run-table',
);
// Headers.
$header = array();
foreach ($stats as $stat) {
$desc = xhprof_stat_description($stat);
if (array_key_exists($stat, xhprof_sortable_columns($stat))) {
if (isset($_GET['sort']) && $stat == $_GET['sort']) {
$header_desc = l(t($desc), $_GET['q'], array(
'query' => array(
'sort' => $stat,
),
t($desc),
));
$header[] = array(
'data' => t($header_desc) . theme('tablesort_indicator', 'desc'),
);
}
else {
$header_desc = l(t($desc), $_GET['q'], array(
'query' => array(
'sort' => $stat,
),
t($desc),
));
$header[] = array(
'data' => t($header_desc),
);
}
}
else {
$header[] = array(
'data' => t($desc),
);
}
}
// Table rows
$rows = array();
$trail = menu_get_active_trail();
foreach ($flat_data as $data) {
$row = array(
array(
'data' => l($data["fn"], $trail[1]["href"] . '/' . $data["fn"]),
),
array(
'data' => $data['ct'],
'class' => 'xhprof_micro',
),
array(
'data' => xhprof_print_pct($data['ct'], $totals['ct']),
'class' => 'xhprof_percent',
),
array(
'data' => $data['wt'],
'class' => 'xhprof_micro',
),
array(
'data' => xhprof_print_pct($data['wt'], $totals['wt']),
),
array(
'data' => $data['excl_wt'],
'class' => 'xhprof_percent',
),
array(
'data' => xhprof_print_pct($data['excl_wt'], $totals['wt']),
'class' => 'xhprof_micro',
),
array(
'data' => $data['cpu'],
'class' => 'xhprof_percent',
),
array(
'data' => xhprof_print_pct($data['cpu'], $totals['cpu']),
'class' => 'xhprof_percent',
),
array(
'data' => $data['excl_cpu'],
'class' => 'xhprof_micro',
),
array(
'data' => xhprof_print_pct($data['excl_cpu'], $totals['cpu']),
'class' => 'xhprof_percent',
),
array(
'data' => $data['mu'],
'class' => 'xhprof_micro',
),
array(
'data' => xhprof_print_pct($data['mu'], $totals['mu']),
'class' => 'xhprof_percent',
),
array(
'data' => $data['excl_mu'],
'class' => 'xhprof_micro',
),
array(
'data' => xhprof_print_pct($data['excl_mu'], $totals['mu']),
'xhprof_percent',
),
array(
'data' => $data['pmu'],
'class' => 'xhprof_micro',
),
array(
'data' => xhprof_print_pct($data['pmu'], $totals['pmu']),
'xhprof_percent',
),
array(
'data' => $data['excl_pmu'],
'xhprof_micro',
),
array(
'data' => xhprof_print_pct($data['excl_pmu'], $totals['pmu']),
'class' => 'xhprof_percent',
),
);
$rows[] = $row;
}
$size = count($flat_data);
if (!$limit) {
// no limit
$limit = $size;
$display_link = "";
}
else {
$display_link = xhprof_xhprof_render_link(" [ <b class=bubble>display all </b>]", "{$base_path}/?" . http_build_query(xhprof_array_set($url_params, 'all', 1)));
}
$output .= "<h3 align=center>{$title} {$display_link}</h3><br>";
$output .= theme('table', $header, $rows, $attributes);
return $output;
}