Index: base/run_loop.cc |
diff --git a/base/run_loop.cc b/base/run_loop.cc |
index 8344aa41b1631f6946e242e9ef0efbafdee23279..c28c50c8f74dc6c22f8cd17a67c949c47a5780b7 100644 |
--- a/base/run_loop.cc |
+++ b/base/run_loop.cc |
@@ -5,6 +5,7 @@ |
#include "base/run_loop.h" |
#include "base/bind.h" |
+#include "base/tracked_objects.h" |
#if defined(OS_WIN) |
#include "base/message_loop/message_pump_dispatcher.h" |
@@ -46,7 +47,14 @@ RunLoop::~RunLoop() { |
void RunLoop::Run() { |
if (!BeforeRun()) |
return; |
- loop_->RunHandler(); |
+ { |
+ // Use task stopwatch to exclude the loop run time from the current task, if |
+ // any. |
+ tracked_objects::TaskStopwatch stopwatch; |
+ stopwatch.Start(tracked_objects::ThreadData::Now()); |
+ loop_->RunHandler(); |
+ stopwatch.Stop(tracked_objects::ThreadData::Now()); |
+ } |
AfterRun(); |
} |