OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 5 |
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 TraceEvent(const TraceEvent& other); | 94 TraceEvent(const TraceEvent& other); |
95 TraceEvent& operator=(const TraceEvent& other); | 95 TraceEvent& operator=(const TraceEvent& other); |
96 ~TraceEvent(); | 96 ~TraceEvent(); |
97 | 97 |
98 // Serialize event data to JSON | 98 // Serialize event data to JSON |
99 static void AppendEventsAsJSON(const std::vector<TraceEvent>& events, | 99 static void AppendEventsAsJSON(const std::vector<TraceEvent>& events, |
100 size_t start, | 100 size_t start, |
101 size_t count, | 101 size_t count, |
102 std::string* out); | 102 std::string* out); |
103 void AppendAsJSON(std::string* out) const; | 103 void AppendAsJSON(std::string* out) const; |
| 104 void AppendPrettyPrinted(std::ostringstream* out) const; |
104 | 105 |
105 static void AppendValueAsJSON(unsigned char type, | 106 static void AppendValueAsJSON(unsigned char type, |
106 TraceValue value, | 107 TraceValue value, |
107 std::string* out); | 108 std::string* out); |
108 | 109 |
109 TimeTicks timestamp() const { return timestamp_; } | 110 TimeTicks timestamp() const { return timestamp_; } |
110 | 111 |
111 // Exposed for unittesting: | 112 // Exposed for unittesting: |
112 | 113 |
113 const base::RefCountedString* parameter_copy_storage() const { | 114 const base::RefCountedString* parameter_copy_storage() const { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // Record until the trace buffer is full. | 284 // Record until the trace buffer is full. |
284 RECORD_UNTIL_FULL = 1 << 0, | 285 RECORD_UNTIL_FULL = 1 << 0, |
285 | 286 |
286 // Record until the user ends the trace. The trace buffer is a fixed size | 287 // Record until the user ends the trace. The trace buffer is a fixed size |
287 // and we use it as a ring buffer during recording. | 288 // and we use it as a ring buffer during recording. |
288 RECORD_CONTINUOUSLY = 1 << 1, | 289 RECORD_CONTINUOUSLY = 1 << 1, |
289 | 290 |
290 // Enable the sampling profiler. | 291 // Enable the sampling profiler. |
291 ENABLE_SAMPLING = 1 << 2, | 292 ENABLE_SAMPLING = 1 << 2, |
292 | 293 |
293 // Echo to VLOG. Events are discared. | 294 // Echo to console. Events are discared. |
294 ECHO_TO_VLOG = 1 << 3 | 295 ECHO_TO_CONSOLE = 1 << 3 |
295 }; | 296 }; |
296 | 297 |
297 static TraceLog* GetInstance(); | 298 static TraceLog* GetInstance(); |
298 | 299 |
299 // Convert the given string to trace options. Defaults to RECORD_UNTIL_FULL if | 300 // Convert the given string to trace options. Defaults to RECORD_UNTIL_FULL if |
300 // the string does not provide valid options. | 301 // the string does not provide valid options. |
301 static Options TraceOptionsFromString(const std::string& str); | 302 static Options TraceOptionsFromString(const std::string& str); |
302 | 303 |
303 // Get set of known category groups. This can change as new code paths are | 304 // Get set of known category groups. This can change as new code paths are |
304 // reached. The known category groups are inserted into |category_groups|. | 305 // reached. The known category groups are inserted into |category_groups|. |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 583 |
583 CategoryFilter category_filter_; | 584 CategoryFilter category_filter_; |
584 | 585 |
585 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 586 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
586 }; | 587 }; |
587 | 588 |
588 } // namespace debug | 589 } // namespace debug |
589 } // namespace base | 590 } // namespace base |
590 | 591 |
591 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 592 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |