You are here

function performance_get_summary in Performance Logging and Monitoring 6.2

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

Callback used by performance_traverse_cache() for fetching summary data.

Parameters

$cache cache object:

$timestamp unix timestamp to start fetching data from:

Return value

the processed data or NULL

See also

performance_traverse_cache()

2 string references to 'performance_get_summary'
performance_gather_summary_data in ./performance.module
Gather performance data for external modules.
performance_view_summary in ./performance.module
Summary page callback.

File

./performance.module, line 460
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_get_summary($cache, $timestamp) {
  static $count = 0;

  // Don't combine these IF statemens here, otherwise else might get executed
  // while $timestamp IS set!
  if ($timestamp !== NULL) {
    if ($cache->created >= $timestamp) {

      // return based on timestamp
      return $cache->data;
    }
  }
  else {

    // return paged
    global $pager_page_array, $pager_total_items, $pager_limits, $pager_total;

    // array of element-keyed total number of pages
    $pager_total_items[0]++;
    if ($pager_page_array[0] * $pager_limits[0] < $pager_total_items[0] && $count < $pager_limits[0]) {
      $count++;
      return $cache->data;
    }
  }
  return;
}