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

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: use duration instead 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 0108188aa2d157ad84bed4ada7e10efd657fe5e0..95f5d2d481011c0d9974e54b6850c28307b55eb2 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
@@ -19,6 +19,8 @@
#include "platform/scheduler/base/work_queue_sets.h"
#include "platform/wtf/PtrUtil.h"
+static const double kLongTaskTraceEventThreshold = 0.05;
+
namespace blink {
namespace scheduler {
@@ -535,11 +537,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);
queue->OnTaskCompleted(
base::TimeTicks() + base::TimeDelta::FromSecondsD(task_start_time),
@@ -554,6 +556,12 @@ TaskQueueManager::ProcessTaskResult TaskQueueManager::ProcessTaskFromWorkQueue(
queue->NotifyDidProcessTask(pending_task);
}
+ if (task_start_time && task_end_time &&
+ task_end_time - task_start_time > kLongTaskTraceEventThreshold) {
+ TRACE_EVENT_INSTANT1("blink", "LongTask", TRACE_EVENT_SCOPE_THREAD,
+ "duration", task_end_time - task_start_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