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

Unified Diff: base/debug/task_annotator.cc

Issue 1239593002: Implement a new flow event API that allows binding flow events and regular events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement binding flow events to slices for PostTasks. Created 5 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 | « no previous file | base/threading/sequenced_worker_pool.cc » ('j') | base/trace_event/trace_event.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/task_annotator.cc
diff --git a/base/debug/task_annotator.cc b/base/debug/task_annotator.cc
index 19df8cb39e5129b9c02987f919b8bdb7cc1d7760..e456089d95dce17916c1ffe8a015e08f9d9fcd95 100644
--- a/base/debug/task_annotator.cc
+++ b/base/debug/task_annotator.cc
@@ -20,6 +20,9 @@ TaskAnnotator::~TaskAnnotator() {
void TaskAnnotator::DidQueueTask(const char* queue_function,
const PendingTask& pending_task) {
+ TRACE_EVENT_WITH_FLOW0("toplevel", "TaskAnnotator::DidQueueTask",
+ TRACE_ID_MANGLE(GetTaskTraceID(pending_task)),
+ TRACE_EVENT_FLAG_FLOW_OUT);
TRACE_EVENT_FLOW_BEGIN0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"),
queue_function,
TRACE_ID_MANGLE(GetTaskTraceID(pending_task)));
@@ -33,24 +36,21 @@ void TaskAnnotator::RunTask(const char* queue_function,
tracked_objects::Duration queue_duration =
stopwatch.StartTime() - pending_task.EffectiveTimePosted();
- TRACE_EVENT_FLOW_END1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"),
- queue_function,
- TRACE_ID_MANGLE(GetTaskTraceID(pending_task)),
- "queue_duration",
- queue_duration.InMilliseconds());
-
// When tracing memory for posted tasks it's more valuable to attribute the
// memory allocations to the source function than generically to the task
// runner.
- TRACE_EVENT_WITH_MEMORY_TAG2(
- "toplevel",
- run_function,
+ TRACE_EVENT_WITH_MEMORY_TAG_WITH_FLOW2(
+ "toplevel", run_function,
pending_task.posted_from.function_name(), // Name for memory tracking.
- "src_file",
- pending_task.posted_from.file_name(),
- "src_func",
+ TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), TRACE_EVENT_FLAG_FLOW_IN,
+ "src_file", pending_task.posted_from.file_name(), "src_func",
pending_task.posted_from.function_name());
+ TRACE_EVENT_FLOW_END1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"),
+ queue_function,
+ TRACE_ID_MANGLE(GetTaskTraceID(pending_task)),
+ "queue_duration", queue_duration.InMilliseconds());
+
// Before running the task, store the program counter where it was posted
// and deliberately alias it to ensure it is on the stack if the task
// crashes. Be careful not to assume that the variable itself will have the
« no previous file with comments | « no previous file | base/threading/sequenced_worker_pool.cc » ('j') | base/trace_event/trace_event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698