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

Side by Side Diff: base/debug/task_annotator.cc

Issue 2956683002: chrome://profiler infrastructure uses base time types. (Closed)
Patch Set: Address nit. 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 unified diff | Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/profiler/scoped_profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/task_annotator.h" 5 #include "base/debug/task_annotator.h"
6 6
7 #include <array> 7 #include <array>
8 8
9 #include "base/debug/activity_tracker.h" 9 #include "base/debug/activity_tracker.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 17 matching lines...) Expand all
28 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), 28 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)),
29 TRACE_EVENT_FLAG_FLOW_OUT); 29 TRACE_EVENT_FLAG_FLOW_OUT);
30 } 30 }
31 31
32 void TaskAnnotator::RunTask(const char* queue_function, 32 void TaskAnnotator::RunTask(const char* queue_function,
33 PendingTask* pending_task) { 33 PendingTask* pending_task) {
34 ScopedTaskRunActivity task_activity(*pending_task); 34 ScopedTaskRunActivity task_activity(*pending_task);
35 35
36 tracked_objects::TaskStopwatch stopwatch; 36 tracked_objects::TaskStopwatch stopwatch;
37 stopwatch.Start(); 37 stopwatch.Start();
38 tracked_objects::Duration queue_duration = 38 base::TimeDelta queue_duration =
39 stopwatch.StartTime() - pending_task->EffectiveTimePosted(); 39 stopwatch.StartTime() - pending_task->EffectiveTimePosted();
40 40
41 TRACE_EVENT_WITH_FLOW1( 41 TRACE_EVENT_WITH_FLOW1(
42 TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), queue_function, 42 TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), queue_function,
43 TRACE_ID_MANGLE(GetTaskTraceID(*pending_task)), TRACE_EVENT_FLAG_FLOW_IN, 43 TRACE_ID_MANGLE(GetTaskTraceID(*pending_task)), TRACE_EVENT_FLAG_FLOW_IN,
44 "queue_duration", queue_duration.InMilliseconds()); 44 "queue_duration", queue_duration.InMilliseconds());
45 45
46 // Before running the task, store the task backtrace with the chain of 46 // Before running the task, store the task backtrace with the chain of
47 // PostTasks that resulted in this call and deliberately alias it to ensure 47 // PostTasks that resulted in this call and deliberately alias it to ensure
48 // it is on the stack if the task crashes. Be careful not to assume that the 48 // it is on the stack if the task crashes. Be careful not to assume that the
(...skipping 15 matching lines...) Expand all
64 } 64 }
65 65
66 uint64_t TaskAnnotator::GetTaskTraceID(const PendingTask& task) const { 66 uint64_t TaskAnnotator::GetTaskTraceID(const PendingTask& task) const {
67 return (static_cast<uint64_t>(task.sequence_num) << 32) | 67 return (static_cast<uint64_t>(task.sequence_num) << 32) |
68 ((static_cast<uint64_t>(reinterpret_cast<intptr_t>(this)) << 32) >> 68 ((static_cast<uint64_t>(reinterpret_cast<intptr_t>(this)) << 32) >>
69 32); 69 32);
70 } 70 }
71 71
72 } // namespace debug 72 } // namespace debug
73 } // namespace base 73 } // namespace base
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/profiler/scoped_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698