function print_pct($numer, $denom) { if ($denom == 0) { $pct = "N/A%"; } else { $pct = xhprof_percent_format($numer / abs($denom)); } return $pct; }
/** * Prints a <td> element with a pecentage. */ function print_td_pct($numer, $denom, $bold = false, $attributes = null) { global $vbar; global $vbbar; global $diff_mode; $class = get_print_class($numer, $bold); if ($denom == 0) { $pct = "N/A%"; } else { $pct = xhprof_percent_format($numer / abs($denom)); } print "<td {$attributes} {$class}>{$pct}</td>\n"; }
function print_column_info($info, $column, $meta) { global $totals; $class = CurrentPageHelper::getParam('sort') == $column ? 'class="sorted-by"' : ''; print "<td {$class}>"; $cb = isset($meta['cb']) ? $meta['cb'] : 'number_format'; echo call_user_func($cb, $info[$column]); print '</td>'; if (!empty($meta['percentage'])) { print "<td {$class}>"; $totalColumn = !empty($meta['total']) ? $meta['total'] : $column; if ($totals[$totalColumn] != 0) { echo xhprof_percent_format($info[$column] / abs($totals[$totalColumn])); } else { echo 'N/A%'; } print '</td>'; } }