diff --git a/includes/performance.details.inc b/includes/performance.details.inc
new file mode 100644
index 0000000..00f0382
--- /dev/null
+++ b/includes/performance.details.inc
@@ -0,0 +1,111 @@
+<?php
+
+/**
+ * @file
+ * Views integration for the Performance module.
+ */
+
+/**
+ * Helper function to store detailed data in database.
+ */
+function performance_log_details($params = array()) {
+  $fields = array(
+    'timestamp' => REQUEST_TIME,
+    'bytes' => $params['mem'],
+    'ms' => (int)$params['timer'],
+    'query_count' => $params['query_count'],
+    'query_timer' => (int)$params['query_timer'],
+    'anon' => $params['anon'],
+    'path' => $params['path'],
+    'language' => $params['language'],
+    'data' => $params['data'],
+  );
+
+  try {
+    db_insert('performance_detail')
+      ->fields($fields)
+      ->execute();
+  }
+  catch (Exception $e) {
+    watchdog_exception('performance', $e, NULL, array(), WATCHDOG_ERROR);
+  }
+}
+
+/**
+ * Detail page callback.
+ */
+function performance_view_details() {
+  drupal_set_title(t('Performance logs: Details'));
+
+  $header = array(
+    array('data' => t('#'), 'field' => 'pid', 'sort' => 'desc'),
+    array('data' => t('Path'), 'field' => 'path'),
+    array('data' => t('Date'), 'field' => 'timestamp'),
+    array('data' => t('Memory (MB)'), 'field' => 'bytes'),
+    array('data' => t('ms (Total)'), 'field' => 'ms'),
+    array('data' => t('Language'), 'field' => 'language'),
+    array('data' => t('Anonymous?'), 'field' => 'anon'),
+  );
+  if (variable_get(PERFORMANCE_QUERY_VAR, 0)) {
+    $header[] = array('data' => t('# Queries'), 'field' => 'query_count');
+    $header[] = array('data' => t('Query ms'),  'field' => 'query_timer');
+  }
+
+  $pager_height = 50;
+  $result = db_select('performance_detail', 'p')
+    ->fields('p')
+    ->extend('PagerDefault')
+    ->limit($pager_height)
+    ->extend('TableSort')
+    ->orderByHeader($header)
+    ->execute();
+
+  $rows = array();
+
+  foreach ($result as $data) {
+    $row_data = array();
+    $row_data[] = $data->pid;
+    $row_data[] = l($data->path, $data->path);
+    $row_data[] = format_date($data->timestamp, 'small');
+    $row_data[] = number_format($data->bytes / 1024 / 1024, 2);
+    $row_data[] = $data->ms;
+    $row_data[] = $data->language;
+    $row_data[] = ($data->anon) ? t('Yes') : t('No');
+
+    if (variable_get(PERFORMANCE_QUERY_VAR, 0)) {
+      $row_data[] = $data->query_count;
+      $row_data[] = $data->query_timer;
+    }
+
+    $rows[] = array('data' => $row_data);
+  }
+
+  if (empty($rows) && !variable_get('performance_detail', 0)) {
+    return array(
+      'content' => array(
+        '#markup' => t('Detail performance log is not enabled. Go to the !link to enable it.', array('!link' => l(t('settings page'), PERFORMANCE_SETTINGS, array('query' => drupal_get_destination()))))
+      ),
+    );
+  }
+  elseif (!variable_get('performance_detail', 0)) {
+    drupal_set_message(t('Detail performance log is not enabled! Showing stored logs.'), 'warning');
+  }
+
+  // Return a renderable array.
+  return array(
+    'query_data_detail' => array(
+      '#theme' => 'table',
+      '#header' => $header,
+      '#rows' => $rows,
+      '#sticky' => TRUE,
+      '#empty' => t('No log messages available.'),
+    ),
+    'clear' => array(
+      '#markup' => l(t('Clear logs'), 'admin/reports/performance-logging/clear/details'),
+    ),
+    'pager' => array(
+      '#theme' => 'pager',
+      '#quantity' => $pager_height,
+    ),
+  );
+}
diff --git a/performance.module b/performance.module
index eee5c1b..f4f773f 100644
--- a/performance.module
+++ b/performance.module
@@ -23,6 +23,8 @@ define('PERFORMANCE_CACHE', 'cache_default_class');
 
 define('PERFORMANCE_SETTINGS', 'admin/config/development/performance-logging');
 
+include_once variable_get('performance_detail_logging', 'includes/performance.details.inc');
+
 /**
  * Implements hook_menu().
  */
@@ -311,6 +313,7 @@ function performance_shutdown() {
     // it was undocumented and therefore unknown, it has been removed. The data
     // column has been kept so that we can re-implement if needed.
     $params['data'] = NULL;
+
     performance_log_details($params);
   }
   // There used to be a module_invoke_all('performance', 'disable') call here in
@@ -482,32 +485,6 @@ function performance_get_summary($cache, $timestamp) {
 }
 
 /**
- * Helper function to store detailed data in database.
- */
-function performance_log_details($params = array()) {
-  $fields = array(
-    'timestamp' => REQUEST_TIME,
-    'bytes' => $params['mem'],
-    'ms' => (int)$params['timer'],
-    'query_count' => $params['query_count'],
-    'query_timer' => (int)$params['query_timer'],
-    'anon' => $params['anon'],
-    'path' => $params['path'],
-    'language' => $params['language'],
-    'data' => $params['data'],
-  );
-
-  try {
-    db_insert('performance_detail')
-      ->fields($fields)
-      ->execute();
-  }
-  catch (Exception $e) {
-    watchdog_exception('performance', $e, NULL, array(), WATCHDOG_ERROR);
-  }
-}
-
-/**
  * Summary page callback.
  */
 function performance_view_summary() {
@@ -689,85 +666,6 @@ function performance_sort_summary($data, $direction, $field) {
 }
 
 /**
- * Detail page callback.
- */
-function performance_view_details() {
-  drupal_set_title(t('Performance logs: Details'));
-
-  $header = array(
-    array('data' => t('#'), 'field' => 'pid', 'sort' => 'desc'),
-    array('data' => t('Path'), 'field' => 'path'),
-    array('data' => t('Date'), 'field' => 'timestamp'),
-    array('data' => t('Memory (MB)'), 'field' => 'bytes'),
-    array('data' => t('ms (Total)'), 'field' => 'ms'),
-    array('data' => t('Language'), 'field' => 'language'),
-    array('data' => t('Anonymous?'), 'field' => 'anon'),
-  );
-  if (variable_get(PERFORMANCE_QUERY_VAR, 0)) {
-    $header[] = array('data' => t('# Queries'), 'field' => 'query_count');
-    $header[] = array('data' => t('Query ms'),  'field' => 'query_timer');
-  }
-
-  $pager_height = 50;
-  $result = db_select('performance_detail', 'p')
-    ->fields('p')
-    ->extend('PagerDefault')
-    ->limit($pager_height)
-    ->extend('TableSort')
-    ->orderByHeader($header)
-    ->execute();
-
-  $rows = array();
-
-  foreach ($result as $data) {
-    $row_data = array();
-    $row_data[] = $data->pid;
-    $row_data[] = l($data->path, $data->path);
-    $row_data[] = format_date($data->timestamp, 'small');
-    $row_data[] = number_format($data->bytes / 1024 / 1024, 2);
-    $row_data[] = $data->ms;
-    $row_data[] = $data->language;
-    $row_data[] = ($data->anon) ? t('Yes') : t('No');
-
-    if (variable_get(PERFORMANCE_QUERY_VAR, 0)) {
-      $row_data[] = $data->query_count;
-      $row_data[] = $data->query_timer;
-    }
-
-    $rows[] = array('data' => $row_data);
-  }
-
-  if (empty($rows) && !variable_get('performance_detail', 0)) {
-    return array(
-      'content' => array(
-        '#markup' => t('Detail performance log is not enabled. Go to the !link to enable it.', array('!link' => l(t('settings page'), PERFORMANCE_SETTINGS, array('query' => drupal_get_destination()))))
-      ),
-    );
-  }
-  elseif (!variable_get('performance_detail', 0)) {
-    drupal_set_message(t('Detail performance log is not enabled! Showing stored logs.'), 'warning');
-  }
-
-  // Return a renderable array.
-  return array(
-    'query_data_detail' => array(
-      '#theme' => 'table',
-      '#header' => $header,
-      '#rows' => $rows,
-      '#sticky' => TRUE,
-      '#empty' => t('No log messages available.'),
-    ),
-    'clear' => array(
-      '#markup' => l(t('Clear logs'), 'admin/reports/performance-logging/clear/details'),
-    ),
-    'pager' => array(
-      '#theme' => 'pager',
-      '#quantity' => $pager_height,
-    ),
-  );
-}
-
-/**
  * Clear logs form.
  */
 function performance_clear_form($form, &$form_state, $store = NULL) {
