You are here

function xhprof_get_print_class in XHProf 7

Same name and namespace in other branches
  1. 6 xhprof.inc \xhprof_get_print_class()

Given a number, returns the td class to use for display.

For instance, negative numbers in diff reports comparing two runs (run1 & run2) represent improvement from run1 to run2. We use green to display those deltas, and red for regression deltas.

2 calls to xhprof_get_print_class()
xhprof_print_num in ./xhprof.inc
Prints a <td> element with a numeric value.
xhprof_print_pct in ./xhprof.inc
Prints a <td> element with a pecentage.

File

./xhprof.inc, line 686

Code

function xhprof_get_print_class($num, $bold) {
  global $vbar;
  global $vbbar;
  global $vrbar;
  global $vgbar;
  global $diff_mode;
  if ($bold) {
    if ($diff_mode) {
      if ($num <= 0) {
        $class = 'vgbar';

        // green (improvement)
      }
      else {
        $class = 'vrbar';

        // red (regression)
      }
    }
    else {
      $class = 'vbbar';

      // blue
    }
  }
  else {
    $class = 'vbar';

    // default (black)
  }
  return $class;
}