Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1415)

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc

Issue 2966073003: Long tasks: add a trace event for long tasks (Closed)
Patch Set: remove unrelated files Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
index d409fcf8f7e411d7bbf53e1ae2e8fde7d75294bf..357c8ed0ae94de775ebcf60f7ef69f953e59eba0 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
@@ -18,6 +18,8 @@
#include "platform/scheduler/base/work_queue.h"
#include "platform/scheduler/base/work_queue_sets.h"
+static const double kLongTaskTraceEventThreshold = 0.05;
+
namespace blink {
namespace scheduler {
@@ -536,11 +538,11 @@ TaskQueueManager::ProcessTaskResult TaskQueueManager::ProcessTaskFromWorkQueue(
currently_executing_task_queue_ = prev_executing_task_queue;
-
+ double task_end_time = 0;
if (queue->GetShouldNotifyObservers()) {
if (task_start_time) {
*time_after_task = real_time_domain()->Now();
- double task_end_time = MonotonicTimeInSeconds(*time_after_task);
+ task_end_time = MonotonicTimeInSeconds(*time_after_task);
for (auto& observer : task_time_observers_)
observer.DidProcessTask(queue, task_start_time, task_end_time);
}
@@ -550,6 +552,12 @@ TaskQueueManager::ProcessTaskResult TaskQueueManager::ProcessTaskFromWorkQueue(
queue->NotifyDidProcessTask(pending_task);
}
+ if (task_start_time && task_end_time &&
+ task_end_time - task_start_time > kLongTaskTraceEventThreshold) {
+ TRACE_EVENT2("blink", "LongTask", "start_time", task_start_time, "end_time",
altimin 2017/07/07 18:24:17 This will be shown in the UI as an extremely short
caseq 2017/07/07 18:54:44 +1 to this, I don't think it makes sense in the pr
Liquan (Max) Gu 2017/07/07 20:01:25 I have changed to emit an instant event. From th
+ task_end_time);
+ }
+
return ProcessTaskResult::EXECUTED;
}
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698