diff --git a/includes/module.inc b/includes/module.inc
index 06bc979..3d2e468 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -892,12 +892,14 @@ function module_invoke($module, $hook) {
  * @see drupal_alter()
  */
 function module_invoke_all($hook) {
+  $times = [];
   $args = func_get_args();
   // Remove $hook from the arguments.
   unset($args[0]);
   $return = array();
   foreach (module_implements($hook) as $module) {
     $function = $module . '_' . $hook;
+    $startTime = microtime(true);
     if (function_exists($function)) {
       $result = call_user_func_array($function, $args);
       if (isset($result) && is_array($result)) {
@@ -907,8 +909,10 @@ function module_invoke_all($hook) {
         $return[] = $result;
       }
     }
+    $times[$function] = microtime(true) - $startTime;
   }
 
+  arsort($times);
   return $return;
 }
 
