includes/functions.php
changeset 424 f58e0b6e9c22
parent 411 d1a95497b68f
child 436 242353360e37
--- a/includes/functions.php	Thu Feb 14 21:57:04 2008 -0500
+++ b/includes/functions.php	Sat Feb 16 16:56:08 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'];