You are here

function performance_log_summary_apc in Devel 5

1 call to performance_log_summary_apc()
performance_shutdown in performance/performance.module

File

performance/performance.module, line 179

Code

function performance_log_summary_apc($params = array()) {
  $key = PERFORMANCE_KEY . $params['path'];
  if ($data = apc_fetch($key)) {
    $data = array(
      'path' => $data['path'],
      'last_access' => time(),
      'bytes_max' => max($params['mem'], $data['bytes_max']),
      'bytes_avg' => ($data['bytes_avg'] + $params['mem']) / 2,
      'millisecs_max' => max($params['timer'], $data['millisecs_max']),
      'millisecs_avg' => ($data['millisecs_avg'] + $params['timer']) / 2,
      'query_timer_max' => max($params['query_timer'], $data['query_timer_max']),
      'query_timer_avg' => ($data['query_timer_avg'] + $params['query_timer']) / 2,
      'query_count_max' => max($params['query_count'], $data['query_count_max']),
      'query_count_avg' => ($data['query_count_avg'] + $params['query_count']) / 2,
      'num_accesses' => $data['num_accesses'] + 1,
    );
  }
  else {
    $data = array(
      'path' => $params['path'],
      'bytes_max' => $params['mem'],
      'bytes_avg' => $params['mem'],
      'millisecs_max' => $params['timer'],
      'millisecs_avg' => $params['timer'],
      'query_timer_max' => $params['query_timer'],
      'query_timer_avg' => $params['query_timer'],
      'query_count_max' => $params['query_count'],
      'query_count_avg' => $params['query_count'],
      'num_accesses' => 1,
      'last_access' => time(),
    );
  }
  apc_store($key, $data);
}