Permalink
Browse files

admin/cron: if $PERF->dbqueries is set, profile modules...

The cron() function of some modules can be a huge drag on the
server. Capture profiling data...
  • Loading branch information...
1 parent 08c28a9 commit 16ce3928ccb781a81cc524083cdadfbdd5a35711 martinlanghoff committed Sep 12, 2007
Showing with 8 additions and 0 deletions.
  1. +8 −0 admin/cron.php
View
@@ -98,11 +98,19 @@
$cron_function = $mod->name."_cron";
if (function_exists($cron_function)) {
mtrace("Processing module function $cron_function ...", '');
+ if (!empty($PERF->dbqueries)) {
+ $pre_dbqueries = $PERF->dbqueries;
+ $pre_time = microtime(1);
+ }
if ($cron_function()) {
if (! set_field("modules", "lastcron", $timenow, "id", $mod->id)) {
mtrace("Error: could not update timestamp for $mod->fullname");
}
}
+ if (isset($pre_dbqueries)) {
+ mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
+ mtrace("... used " . (microtime(1) - $pre_time) . " seconds");
+ }
mtrace("done.");
}
}

0 comments on commit 16ce392

Please sign in to comment.