Skip to content

Instantly share code, notes, and snippets.

@arnested
Created May 31, 2013 13:33
Show Gist options
  • Select an option

  • Save arnested/5684992 to your computer and use it in GitHub Desktop.

Select an option

Save arnested/5684992 to your computer and use it in GitHub Desktop.
diff --git a/includes/common.inc b/includes/common.inc
index 8276576..0c23731 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5214,7 +5214,10 @@ function drupal_cron_run() {
drupal_register_shutdown_function('drupal_cron_cleanup');
// Iterate through the modules calling their cron handlers (if any):
+ $start = microtime(TRUE);
+ error_log('Module crons started');
foreach (module_implements('cron') as $module) {
+ $task_start = microtime(TRUE);
// Do not let an exception thrown by one module disturb another.
try {
module_invoke($module, 'cron');
@@ -5222,7 +5225,9 @@ function drupal_cron_run() {
catch (Exception $e) {
watchdog_exception('cron', $e);
}
+ error_log('---- Task ' . $module . ' finished in ' . round((microtime(TRUE) - $task_start) * 1000, 3) . ' milliseconds');
}
+ error_log('Module cron jobs finished in ' . round((microtime(TRUE) - $start), 3) . ' seconds');
// Record cron time.
variable_set('cron_last', REQUEST_TIME);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment