Skip to content
Permalink
Browse files

moodlelib: moodle_request_shutdown() prints included files

If MDL_PERFINC is defined, we now print to errorlog a listing
of the files included, their size, and then a total size.

The total size isn't the most important metric, though it does give us
a good idea of how much PHP the PHP engine is parsing for us. The main
cost is still in the seeks involved.

Even when using precompilers -- our best-case scenario -- each include
or require forces at least 2 stat()s to compare timestamps in the php
file vs the precompiled file. If the working set fits in buffers we are
fine, but our 60+ stat() calls per page is quite a bit.
  • Loading branch information...
martinlanghoff
martinlanghoff committed Sep 19, 2007
1 parent 0146bd4 commit 2a2057736ee07a0f1cf4f7f1092d9a4bb8fb9ecd
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/moodlelib.php
@@ -6871,6 +6871,25 @@ function moodle_request_shutdown() {
$perf = get_performance_info();
error_log("PERF: " . $perf['txt']);
}
if (defined('MDL_PERFINC')) {
$inc = get_included_files();
$ts = 0;
foreach($inc as $f) {
if (preg_match(':^/:', $f)) {
$fs = filesize($f);
$ts += $fs;
$hfs = display_size($fs);
error_log(substr($f,strlen($CFG->dirroot)) . " size: $fs ($hfs)"
, NULL, NULL, 0);
} else {
error_log($f , NULL, NULL, 0);
}
}
if ($ts > 0 ) {
$hts = display_size($ts);
error_log("Total size of files included: $ts ($hts)");
}
}
}
}

0 comments on commit 2a20577

Please sign in to comment.
You can’t perform that action at this time.