You are here

function devel_query_summary in Devel 7

Same name and namespace in other branches
  1. 5 devel.module \devel_query_summary()
  2. 6 devel.module \devel_query_summary()

Returns the query summary.

Return value

array An index array containing: 0: The an associative array where the keys are the queries and the values are number of times that query was executes. 1: The summary. 2: An associative array of substitution variables to be applied in the previous element.

2 calls to devel_query_summary()
devel_shutdown_query in ./devel.module
Returns the rendered query log.
devel_shutdown_summary in ./devel.module
Returns the rendered shutdown summary.

File

./devel.module, line 1322
This module holds functions useful for Drupal development.

Code

function devel_query_summary($queries) {
  if (variable_get('devel_query_display', FALSE) && is_array($queries)) {
    $sum = 0;
    foreach ($queries as $query) {
      $text[] = $query['query'];
      $sum += $query['time'];
    }
    $counts = array_count_values($text);
    return array(
      $counts,
      t_safe('Executed @queries queries in @time ms.', array(
        '@queries' => count($queries),
        '@time' => round($sum * 1000, 2),
      )),
    );
  }
}