You are here

function performance_log_summary in Performance Logging and Monitoring 6.2

Same name and namespace in other branches
  1. 7.2 performance.module \performance_log_summary()

Store the summary data.

1 call to performance_log_summary()
performance_shutdown in ./performance.module
Shutdown function that collects all performance data.

File

./performance.module, line 330
Logs detailed and/or summary page generation time and memory consumption for page requests. Copyright Khalid Baheyeldin 2008 of http://2bits.com

Code

function performance_log_summary($params) {
  $key = PERFORMANCE_KEY . $params['path'] . ':' . $params['language'] . ':' . $params['anon'];
  $data = cache_get($key, PERFORMANCE_BIN);
  if (is_object($data)) {
    $data = $data->data;
  }
  $result = performance_build_summary_data($data, $params);
  if ($result['type'] == 'new') {

    // $keys_cache is used to easily retrieve our data later on.
    if ($keys_cache = cache_get(PERFORMANCE_KEY, PERFORMANCE_BIN)) {
      $keys_values = $keys_cache->data;
    }

    // Keep the key for the key cache store. We do it this way so that keys
    // will replace eachother which would not happen when using
    // $keys_values[] = $key;
    $keys_values[$key] = 1;
    cache_set(PERFORMANCE_KEY, $keys_values, PERFORMANCE_BIN);
  }

  // Keep records for 1 day.
  $expire = $result['data']['last_access'] + 24 * 60 * 60;
  cache_set($key, $result['data'], PERFORMANCE_BIN, $expire);
}