Chromium Code Reviews| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 // Options determines how the trace buffer stores data. | 271 // Options determines how the trace buffer stores data. |
| 272 enum Options { | 272 enum Options { |
| 273 // Record until the trace buffer is full. | 273 // Record until the trace buffer is full. |
| 274 RECORD_UNTIL_FULL = 1 << 0, | 274 RECORD_UNTIL_FULL = 1 << 0, |
| 275 | 275 |
| 276 // Record until the user ends the trace. The trace buffer is a fixed size | 276 // Record until the user ends the trace. The trace buffer is a fixed size |
| 277 // and we use it as a ring buffer during recording. | 277 // and we use it as a ring buffer during recording. |
| 278 RECORD_CONTINUOUSLY = 1 << 1, | 278 RECORD_CONTINUOUSLY = 1 << 1, |
| 279 | 279 |
| 280 // Enable the sampling profiler. | 280 // Enable the sampling profiler. |
| 281 ENABLE_SAMPLING = 1 << 2 | 281 ENABLE_SAMPLING = 1 << 2, |
| 282 | |
| 283 // Echo to stderr. | |
| 284 ECHO_TO_STDERR = 1 << 3 | |
| 282 }; | 285 }; |
| 283 | 286 |
| 284 static TraceLog* GetInstance(); | 287 static TraceLog* GetInstance(); |
| 285 | 288 |
| 286 // Convert the given string to trace options. Defaults to RECORD_UNTIL_FULL if | 289 // Convert the given string to trace options. Defaults to RECORD_UNTIL_FULL if |
| 287 // the string does not provide valid options. | 290 // the string does not provide valid options. |
| 288 static Options TraceOptionsFromString(const std::string& str); | 291 static Options TraceOptionsFromString(const std::string& str); |
| 289 | 292 |
| 290 // Get set of known category groups. This can change as new code paths are | 293 // Get set of known category groups. This can change as new code paths are |
| 291 // reached. The known category groups are inserted into |category_groups|. | 294 // reached. The known category groups are inserted into |category_groups|. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 // This lock protects TraceLog member accesses from arbitrary threads. | 511 // This lock protects TraceLog member accesses from arbitrary threads. |
| 509 Lock lock_; | 512 Lock lock_; |
| 510 int enable_count_; | 513 int enable_count_; |
| 511 NotificationCallback notification_callback_; | 514 NotificationCallback notification_callback_; |
| 512 scoped_ptr<TraceBuffer> logged_events_; | 515 scoped_ptr<TraceBuffer> logged_events_; |
| 513 EventCallback event_callback_; | 516 EventCallback event_callback_; |
| 514 bool dispatching_to_observer_list_; | 517 bool dispatching_to_observer_list_; |
| 515 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_; | 518 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_; |
| 516 | 519 |
| 517 base::hash_map<int, std::string> thread_names_; | 520 base::hash_map<int, std::string> thread_names_; |
| 521 base::hash_map<int, std::vector<TimeTicks> > thread_event_start_times_; | |
|
danakj
2013/04/24 20:10:12
I think you're looking for std::stack for this ins
Ian Vollick
2013/04/24 22:57:11
Done.
| |
| 522 base::hash_map<std::string, int> thread_colors_; | |
| 518 | 523 |
| 519 // XORed with TraceID to make it unlikely to collide with other processes. | 524 // XORed with TraceID to make it unlikely to collide with other processes. |
| 520 unsigned long long process_id_hash_; | 525 unsigned long long process_id_hash_; |
| 521 | 526 |
| 522 int process_id_; | 527 int process_id_; |
| 523 | 528 |
| 524 TimeDelta time_offset_; | 529 TimeDelta time_offset_; |
| 525 | 530 |
| 526 // Allow tests to wake up when certain events occur. | 531 // Allow tests to wake up when certain events occur. |
| 527 const unsigned char* watch_category_; | 532 const unsigned char* watch_category_; |
| 528 std::string watch_event_name_; | 533 std::string watch_event_name_; |
| 529 | 534 |
| 530 Options trace_options_; | 535 Options trace_options_; |
| 531 | 536 |
| 532 // Sampling thread handles. | 537 // Sampling thread handles. |
| 533 scoped_ptr<TraceSamplingThread> sampling_thread_; | 538 scoped_ptr<TraceSamplingThread> sampling_thread_; |
| 534 PlatformThreadHandle sampling_thread_handle_; | 539 PlatformThreadHandle sampling_thread_handle_; |
| 535 | 540 |
| 536 CategoryFilter category_filter_; | 541 CategoryFilter category_filter_; |
| 537 | 542 |
| 538 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 543 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
| 539 }; | 544 }; |
| 540 | 545 |
| 541 } // namespace debug | 546 } // namespace debug |
| 542 } // namespace base | 547 } // namespace base |
| 543 | 548 |
| 544 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 549 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
| OLD | NEW |