You are here

function xhprof_is_enabled in XHProf 7

Same name and namespace in other branches
  1. 6 xhprof.module \xhprof_is_enabled()

Check whether XHProf should be enabled for the current request.

2 calls to xhprof_is_enabled()
xhprof_shutdown in ./xhprof.module
See xhprof_start() which registers this function as a shutdown function.
xhprof_xhprof_enable in ./xhprof.module
Conditionally enable XHProf profiling.

File

./xhprof.module, line 117

Code

function xhprof_is_enabled() {
  $enabled = FALSE;
  if (xhprof_extension_check() && variable_get('xhprof_enabled', FALSE)) {
    $enabled = TRUE;
    if (arg(0) == 'admin' && variable_get('xhprof_disable_admin_paths', TRUE)) {
      $enabled = FALSE;
    }
    if (arg(0) == 'js' && arg(1) == 'admin_menu' && variable_get('xhprof_disable_admin_menu_paths', TRUE)) {
      $enabled = FALSE;
    }
    $interval = variable_get('xhprof_interval', 1);
    if ($interval && mt_rand(1, $interval) % $interval != 0) {
      $enabled = FALSE;
    }
  }
  return $enabled;
}