You are here

function performance_view_details in Devel 5

1 string reference to 'performance_view_details'
performance_menu in performance/performance.module

File

performance/performance.module, line 399

Code

function performance_view_details() {
  if (!variable_get('performance_detail', 0)) {
    return t('Detail performance log is not enabled. Go to the <a href="@link">settings page</a> to enable it.', array(
      '@link' => url('admin/settings/performance_logging'),
    ));
  }
  $header = array(
    array(
      'data' => t('#'),
      'field' => 'pid',
      'sort' => 'desc',
    ),
    array(
      'data' => t('Date'),
      'field' => 'timestamp',
    ),
    array(
      'data' => t('Path'),
      'field' => 'path',
    ),
    array(
      'data' => t('Memory (MB)'),
      'field' => 'bytes',
    ),
    array(
      'data' => t('Milliseconds (Total)'),
      'field' => 'millisecs',
    ),
    array(
      'data' => t('Anonymous?'),
      'field' => 'anon',
    ),
    array(
      'data' => t('# Queries'),
      'field' => 'query_count',
    ),
    array(
      'data' => t('Query Milliseconds'),
      'field' => 'query_timer',
    ),
  );
  $sql = "SELECT * FROM {performance_detail}";
  $tablesort = tablesort_sql($header);
  $result = pager_query($sql . $tablesort, 50);
  while ($data = db_fetch_array($result)) {
    $rows[] = array(
      'data' => array(
        $data['pid'],
        format_date($data['timestamp'], 'small'),
        check_plain($data['path']),
        number_format($data['bytes'] / 1024 / 1024, 2),
        $data['millisecs'],
        $data['anon'] ? t('Yes') : t('No'),
        $data['query_count'],
        $data['query_timer'],
      ),
    );
  }
  if (!$rows) {
    $rows[] = array(
      array(
        'data' => t('No log messages available.'),
        'colspan' => count($header),
      ),
    );
  }
  $output .= theme('table', $header, $rows);
  $output .= theme('pager', NULL, 50, 0);
  return $output;
}