includes/functions.php
changeset 431 ceff43bbc3d3
parent 424 f58e0b6e9c22
child 436 242353360e37
--- a/includes/functions.php	Mon Feb 18 16:27:28 2008 -0500
+++ b/includes/functions.php	Mon Feb 18 16:28:27 2008 -0500
@@ -4024,8 +4024,13 @@
   $_profiler[] = array(
       'point' => 'Profiling started',
       'time' => microtime_float(),
-      'backtrace' => false
+      'backtrace' => false,
+      'mem' => false
     );
+  if ( function_exists('memory_get_usage') )
+  {
+    $_profiler[ count($_profiler) - 1 ]['mem'] = memory_get_usage();
+  }
 }
 
 /**
@@ -4048,8 +4053,13 @@
   $_profiler[] = array(
       'point' => $point,
       'time' => microtime_float(),
-      'backtrace' => $backtrace
+      'backtrace' => $backtrace,
+      'mem' => false
     );
+  if ( function_exists('memory_get_usage') )
+  {
+    $_profiler[ count($_profiler) - 1 ]['mem'] = memory_get_usage();
+  }
 }
 
 /**
@@ -4114,6 +4124,14 @@
       $html .= '</tr>' . "\n";
     }
     
+    if ( $entry['mem'] )
+    {
+      $html .= '<tr>' . "\n";
+      $html .= '  <td class="row2">Total mem usage:</td>' . "\n";
+      $html .= '  <td class="row1">' . htmlspecialchars($entry['mem']) . ' (bytes)</td>' . "\n";
+      $html .= '</tr>' . "\n";
+    }
+    
     $html .= "\n";
     
     $time_last = $entry['time'];