Index: index.php
===================================================================
RCS file: /cvs/drupal/drupal/index.php,v
retrieving revision 1.93
diff -u -F^f -r1.93 index.php
--- index.php 6 Apr 2007 13:27:20 -0000 1.93
+++ index.php 27 Aug 2007 17:52:56 -0000
@@ -9,6 +9,8 @@
* prints the appropriate page.
*/
+$mem_start = memory_get_usage();
+
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
@@ -34,3 +36,19 @@
}
drupal_page_footer();
+
+$mem_stop = memory_get_usage();
+$mem_total = $mem_stop - $mem_start;
+
+print "Start,$mem_start
";
+print "End,$mem_stop
";
+print "Total,$mem_total
";
+krsort($module_size);
+$module_total = 0;
+foreach($module_size as $bytes => $module) {
+ $module_total += $bytes;
+ print "$module,". $bytes ."
";
+}
+$bootstrap = $mem_total - $module_total;
+print "Modules,$module_total
";
+print "Bootstrap,$bootstrap
";
Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.108
diff -u -F^f -r1.108 module.inc
--- includes/module.inc 22 Aug 2007 08:36:34 -0000 1.108
+++ includes/module.inc 27 Aug 2007 17:52:56 -0000
@@ -10,8 +10,15 @@
* Load all the modules that have been enabled in the system table.
*/
function module_load_all() {
+ global $module_size;
+
+ $module_size = array();
foreach (module_list(TRUE, FALSE) as $module) {
+ $before = memory_get_usage();
drupal_load('module', $module);
+ $after = memory_get_usage();
+ $bytes = $after - $before;
+ $module_size[$bytes] = $module;
}
}