function theme_xhprof_run_table in XHProf 7
Same name and namespace in other branches
- 6 xhprof.module \theme_xhprof_run_table()
Theme function to display list of XHProf function calls.
1 theme call to theme_xhprof_run_table()
- xhprof_full_report in ./
xhprof.inc - Generates a tabular report for all functions. This is the top-level report.
File
- ./
xhprof.module, line 449
Code
function theme_xhprof_run_table($variables) {
// Extract variables: $stats, $totals, $url_params, $title, $flat_data, $limit.
extract($variables);
global $base_path;
$output = '';
// 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), current_path(), array(
'query' => array(
'sort' => $stat,
),
t($desc),
));
$header[] = array(
'data' => t($header_desc) . theme('tablesort_indicator', array(
'style' => 'desc',
)),
);
}
else {
$header_desc = l(t($desc), current_path(), array(
'query' => array(
'sort' => $stat,
),
t($desc),
));
$header[] = array(
'data' => t($header_desc),
);
}
}
else {
$header[] = array(
'data' => t($desc),
);
}
}
// Table rows
$rows = array();
$i = 0;
foreach ($flat_data as $data) {
$row = array(
array(
'data' => l($data["fn"], xhprof_path_for_symbol($data["fn"], $run1)),
'class' => 'xhprof_symbol',
),
xhprof_print_num_cell($data['ct'], NULL, TRUE),
xhprof_print_pct_cell($data['ct'], $totals['ct'], TRUE),
xhprof_print_num_cell($data['wt'], NULL, TRUE),
xhprof_print_pct_cell($data['wt'], $totals['wt'], TRUE),
xhprof_print_num_cell($data['excl_wt'], NULL, TRUE),
xhprof_print_pct_cell($data['excl_wt'], $totals['wt'], TRUE),
);
if (isset($data['cpu'])) {
$row = array_merge($row, array(
xhprof_print_num_cell($data['cpu'], NULL, TRUE),
xhprof_print_pct_cell($data['cpu'], $totals['cpu'], TRUE),
xhprof_print_num_cell($data['excl_cpu'], NULL, TRUE),
xhprof_print_pct_cell($data['excl_cpu'], $totals['cpu'], TRUE),
));
}
if (isset($data['mu'])) {
$row = array_merge($row, array(
xhprof_print_num_cell($data['mu'], NULL, TRUE),
xhprof_print_pct_cell($data['mu'], $totals['mu'], TRUE),
xhprof_print_num_cell($data['excl_mu'], NULL, TRUE),
xhprof_print_pct_cell($data['excl_mu'], $totals['mu'], TRUE),
xhprof_print_num_cell($data['pmu'], NULL, TRUE),
xhprof_print_pct_cell($data['pmu'], $totals['pmu'], TRUE),
xhprof_print_num_cell($data['excl_pmu'], NULL, TRUE),
xhprof_print_pct_cell($data['excl_pmu'], $totals['pmu'], TRUE),
));
}
$rows[] = $row;
$i++;
if ($limit && $i >= $limit) {
break;
}
}
$size = count($flat_data);
if (!$limit) {
// no limit
$limit = $size;
$display_link = "";
}
else {
$display_link = l(" [ <strong class=bubble>display all </strong>]", current_path(), array(
'query' => xhprof_array_set($url_params, 'all', 1),
'html' => TRUE,
));
}
$output .= "<h3 align=center>{$title} {$display_link}</h3><br>";
$attributes = array(
'class' => array(
'xhprof-table',
'xhprof-run-table',
),
);
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => $attributes,
));
return $output;
}