OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Tracer objects uresed to record an annotated timeline of events for use in | 5 // Tracer objects uresed to record an annotated timeline of events for use in |
6 // gathering performance data. It wraps a TraceBuffer which is the raw data | 6 // gathering performance data. It wraps a TraceBuffer which is the raw data |
7 // for a trace. Tracer is threadsafe. | 7 // for a trace. Tracer is threadsafe. |
8 // | 8 // |
9 // TraceContext is a singleton that is used to give information for the current | 9 // TraceContext is a singleton that is used to give information for the current |
10 // trace. Clients should query TraceContext to find the current tracer and then | 10 // trace. Clients should query TraceContext to find the current tracer and then |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void PopTracerInternal(); | 109 void PopTracerInternal(); |
110 | 110 |
111 Tracer* GetTracerInternal(); | 111 Tracer* GetTracerInternal(); |
112 | 112 |
113 std::vector<scoped_refptr<Tracer> > tracers_; | 113 std::vector<scoped_refptr<Tracer> > tracers_; |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(TraceContext); | 115 DISALLOW_COPY_AND_ASSIGN(TraceContext); |
116 }; | 116 }; |
117 | 117 |
118 // Used to create a new tracer that NewRunnableMethod can propogate from. | 118 // Used to create a new tracer that NewRunnableMethod can propagate from. |
119 // | 119 // |
120 // Declare this at the logical start of a "trace." Calls to NewTracedMethod | 120 // Declare this at the logical start of a "trace." Calls to NewTracedMethod |
121 // that are done with the ScopedTracer object is alive will take a reference | 121 // that are done with the ScopedTracer object is alive will take a reference |
122 // to this tracer. When such a method is invoked, it will push the trace back | 122 // to this tracer. When such a method is invoked, it will push the trace back |
123 // onto the top of the TraceContext stack. The result is that all asynchronous | 123 // onto the top of the TraceContext stack. The result is that all asynchronous |
124 // tasks that are part of one logical flow will share the same trace. | 124 // tasks that are part of one logical flow will share the same trace. |
125 class ScopedTracer { | 125 class ScopedTracer { |
126 public: | 126 public: |
127 ScopedTracer(const std::string& name) { | 127 ScopedTracer(const std::string& name) { |
128 #if defined(USE_TRACE) | 128 #if defined(USE_TRACE) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 e, f, g)); | 243 e, f, g)); |
244 } | 244 } |
245 | 245 |
246 #else | 246 #else |
247 # define NewTracedMethod NewRunnableMethod | 247 # define NewTracedMethod NewRunnableMethod |
248 #endif | 248 #endif |
249 | 249 |
250 } // namespace remoting | 250 } // namespace remoting |
251 | 251 |
252 #endif // REMOTING_BASE_TRACER_H_ | 252 #endif // REMOTING_BASE_TRACER_H_ |
OLD | NEW |