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

Unified Diff: base/message_loop/message_loop.cc

Issue 22909045: Trace memory records source function for posted tasks instead of "RunTask" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better macro style Created 7 years, 4 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 | « base/debug/trace_event.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop.cc
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index 92039e237b885fbdadde39d3269554127a73df9d..4fb13c2211abbf5b5312b334c8b1d4f7367c0f1e 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -458,9 +458,13 @@ void MessageLoop::RunTask(const PendingTask& pending_task) {
TRACE_ID_MANGLE(GetTaskTraceID(pending_task)),
"queue_duration",
(start_time - pending_task.EffectiveTimePosted()).InMilliseconds());
- TRACE_EVENT2("task", "MessageLoop::RunTask",
- "src_file", pending_task.posted_from.file_name(),
- "src_func", pending_task.posted_from.function_name());
+ // When tracing memory for posted tasks it's more valuable to attribute the
+ // memory allocations to the source function than generically to "RunTask".
+ TRACE_EVENT_WITH_MEMORY_TAG2(
+ "task", "MessageLoop::RunTask",
+ pending_task.posted_from.function_name(), // Name for memory tracking.
+ "src_file", pending_task.posted_from.file_name(),
+ "src_func", pending_task.posted_from.function_name());
DCHECK(nestable_tasks_allowed_);
// Execute the task and assume the worst: It is probably not reentrant.
« no previous file with comments | « base/debug/trace_event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698