Record total memory usage in debug messages.
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 18 Apr 2020 18:54:38 +0000 (14:54 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 18 Apr 2020 18:55:17 +0000 (14:55 -0400)
framework/kernel.php
includes/init.php

index 132506bbff0d55795507e97a5c90449e76025ce8..8c5513fcfa21709b94e9b4896efdf6654cfad347 100644 (file)
@@ -158,6 +158,8 @@ define('REQ_NO', 0);
 *              ISSO_MT_START - Define the microtime() value at the top of your
 *                                              script and this will calculate the total execution
 *                                              time
+*              ISSO_MEMORY_START - The result of memory_get_usage(true) at the start of
+*                                                      the script.
 *              SVN - Place SVN keywords (like $Id) to display the information on output
 *
 * @author              Blue Static
@@ -1209,6 +1211,13 @@ class ISSO
                                $debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->modules['functions']->fetch_microtime_diff(ISSO_MT_START), 10) . "</li>";
                        }
 
+                       // total memory usage KB
+                       if (defined('ISSO_MEMORY_START'))
+                       {
+                               $end = memory_get_usage(true);
+                               $debug .= "\n\t<li><strong>Total Memory Usage:</strong> " . ($end - ISSO_MEMORY_USAGE)/1024 . " KB</li>";
+                       }
+
                        // debug notices
                        $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->debuginfo) . ")</option>";
                        foreach ((array)$this->debuginfo AS $msg)
index 4f5c88bc2835dc0e749199e50cec91750dbd72c3..1bb9e6c47f2afab9b019fe8a72f10633180374ab 100644 (file)
@@ -25,6 +25,7 @@ error_reporting(E_ALL & ~E_NOTICE);
 // initialize the database
 
 define('ISSO_MT_START', microtime());
+define('ISSO_MEMORY_START', memory_get_usage(true));
 define('ISSO_CHECK_POST_REFERER', 1);
 
 require_once('./includes/version.php');