Allow to log memory peak usage to the apache log.

From: Damien Tournoud <damien@tournoud.net>


---

 includes/session.inc |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)


diff --git includes/session.inc includes/session.inc
index 8d2281b..bde3506 100644
--- includes/session.inc
+++ includes/session.inc
@@ -155,6 +155,15 @@ function _sess_write($key, $value) {
       ->execute();
   }
 
+  // PHP is now able to report the peak memory usage across the request.
+  // We send this information to Apache so that it can appear in the server logs.
+  // Use the "%{x-drupal-memory-usage}n" directive in a custom log format to
+  // take advantage of this. See http://httpd.apache.org/docs/2.2/mod/mod_log_config.html
+  // for more information.
+  if (function_exists('apache_note')) {
+    apache_note('x-drupal-memory-usage', memory_get_peak_usage());
+  }
+
   return TRUE;
 }
 
