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

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

Issue 2221343002: Revert "Track thread activities in order to diagnose hangs." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « base/debug/activity_tracker_unittest.cc ('k') | base/process/process_posix.cc » ('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 "base/debug/activity_tracker.h"
8 #include "base/debug/alias.h" 7 #include "base/debug/alias.h"
9 #include "base/pending_task.h" 8 #include "base/pending_task.h"
10 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
11 #include "base/tracked_objects.h" 10 #include "base/tracked_objects.h"
12 11
13 namespace base { 12 namespace base {
14 namespace debug { 13 namespace debug {
15 14
16 TaskAnnotator::TaskAnnotator() { 15 TaskAnnotator::TaskAnnotator() {
17 } 16 }
18 17
19 TaskAnnotator::~TaskAnnotator() { 18 TaskAnnotator::~TaskAnnotator() {
20 } 19 }
21 20
22 void TaskAnnotator::DidQueueTask(const char* queue_function, 21 void TaskAnnotator::DidQueueTask(const char* queue_function,
23 const PendingTask& pending_task) { 22 const PendingTask& pending_task) {
24 TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), 23 TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"),
25 queue_function, 24 queue_function,
26 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), 25 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)),
27 TRACE_EVENT_FLAG_FLOW_OUT); 26 TRACE_EVENT_FLAG_FLOW_OUT);
28 } 27 }
29 28
30 void TaskAnnotator::RunTask(const char* queue_function, 29 void TaskAnnotator::RunTask(const char* queue_function,
31 const PendingTask& pending_task) { 30 const PendingTask& pending_task) {
32 ScopedTaskRunActivity task_activity(pending_task);
33
34 tracked_objects::TaskStopwatch stopwatch; 31 tracked_objects::TaskStopwatch stopwatch;
35 stopwatch.Start(); 32 stopwatch.Start();
36 tracked_objects::Duration queue_duration = 33 tracked_objects::Duration queue_duration =
37 stopwatch.StartTime() - pending_task.EffectiveTimePosted(); 34 stopwatch.StartTime() - pending_task.EffectiveTimePosted();
38 35
39 TRACE_EVENT_WITH_FLOW1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), 36 TRACE_EVENT_WITH_FLOW1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"),
40 queue_function, 37 queue_function,
41 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), 38 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)),
42 TRACE_EVENT_FLAG_FLOW_IN, 39 TRACE_EVENT_FLAG_FLOW_IN,
43 "queue_duration", 40 "queue_duration",
(...skipping 15 matching lines...) Expand all
59 } 56 }
60 57
61 uint64_t TaskAnnotator::GetTaskTraceID(const PendingTask& task) const { 58 uint64_t TaskAnnotator::GetTaskTraceID(const PendingTask& task) const {
62 return (static_cast<uint64_t>(task.sequence_num) << 32) | 59 return (static_cast<uint64_t>(task.sequence_num) << 32) |
63 ((static_cast<uint64_t>(reinterpret_cast<intptr_t>(this)) << 32) >> 60 ((static_cast<uint64_t>(reinterpret_cast<intptr_t>(this)) << 32) >>
64 32); 61 32);
65 } 62 }
66 63
67 } // namespace debug 64 } // namespace debug
68 } // namespace base 65 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/activity_tracker_unittest.cc ('k') | base/process/process_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698