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.
This commit is contained in:
martinlanghoff 2007-09-19 07:46:39 +00:00
parent 0146bd4190
commit 2a2057736e

View File

@ -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)");
}
}
}
}