You are here

function performance_shutdown in Performance Logging and Monitoring 5

Same name and namespace in other branches
  1. 6.2 performance.module \performance_shutdown()
  2. 6 performance.module \performance_shutdown()
  3. 7.2 performance.module \performance_shutdown()
  4. 7 performance.module \performance_shutdown()
1 call to performance_shutdown()
performance_exit in ./performance.module
1 string reference to 'performance_shutdown'
performance_init in ./performance.module

File

./performance.module, line 178

Code

function performance_shutdown() {
  global $queries;
  $params = array(
    'timer' => timer_read('page'),
    'path' => $_GET['q'],
  );

  // Memory
  if (function_exists('memory_get_peak_usage')) {
    $params['mem'] = memory_get_peak_usage(TRUE);
  }
  else {
    $params['mem'] = 0;
  }

  // Query time and count
  $query_count = 0;
  $query_timer = 0;
  if (variable_get('dev_query', 0) && is_array($queries)) {
    foreach ($queries as $query) {
      $sum += $query[1];
    }
    $query_count = count($queries);
    $query_timer = round($sum * 1000, 2);
  }
  $params['query_count'] = $query_count;
  $params['query_timer'] = $query_timer;
  if (variable_get('performance_detail', 0)) {
    performance_log_details($params);
  }
  if (variable_get('performance_summary_db', 0)) {
    performance_log_summary_db($params);
  }
  if (variable_get('performance_summary_apc', 0)) {
    if (function_exists('apc_store')) {
      performance_log_summary_apc($params);
    }
  }
}