OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef BASE_TRACE_EVENT_TRACE_LOG_H_ | 5 #ifndef BASE_TRACE_EVENT_TRACE_LOG_H_ |
6 #define BASE_TRACE_EVENT_TRACE_LOG_H_ | 6 #define BASE_TRACE_EVENT_TRACE_LOG_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 unsigned int flags); | 278 unsigned int flags); |
279 | 279 |
280 void UpdateTraceEventDuration(const unsigned char* category_group_enabled, | 280 void UpdateTraceEventDuration(const unsigned char* category_group_enabled, |
281 const char* name, | 281 const char* name, |
282 TraceEventHandle handle); | 282 TraceEventHandle handle); |
283 | 283 |
284 void EndFilteredEvent(const unsigned char* category_group_enabled, | 284 void EndFilteredEvent(const unsigned char* category_group_enabled, |
285 const char* name, | 285 const char* name, |
286 TraceEventHandle handle); | 286 TraceEventHandle handle); |
287 | 287 |
288 // For every matching event, the callback will be called. | |
289 typedef base::Callback<void()> WatchEventCallback; | |
290 void SetWatchEvent(const std::string& category_name, | |
291 const std::string& event_name, | |
292 const WatchEventCallback& callback); | |
293 // Cancel the watch event. If tracing is enabled, this may race with the | |
294 // watch event notification firing. | |
295 void CancelWatchEvent(); | |
296 | |
297 int process_id() const { return process_id_; } | 288 int process_id() const { return process_id_; } |
298 | 289 |
299 uint64_t MangleEventId(uint64_t id); | 290 uint64_t MangleEventId(uint64_t id); |
300 | 291 |
301 // Exposed for unittesting: | 292 // Exposed for unittesting: |
302 | 293 |
303 // Allows deleting our singleton instance. | 294 // Allows deleting our singleton instance. |
304 static void DeleteForTesting(); | 295 static void DeleteForTesting(); |
305 | 296 |
306 class BASE_EXPORT TraceEventFilter { | 297 class BASE_EXPORT TraceEventFilter { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 487 |
497 TimeTicks buffer_limit_reached_timestamp_; | 488 TimeTicks buffer_limit_reached_timestamp_; |
498 | 489 |
499 // XORed with TraceID to make it unlikely to collide with other processes. | 490 // XORed with TraceID to make it unlikely to collide with other processes. |
500 unsigned long long process_id_hash_; | 491 unsigned long long process_id_hash_; |
501 | 492 |
502 int process_id_; | 493 int process_id_; |
503 | 494 |
504 TimeDelta time_offset_; | 495 TimeDelta time_offset_; |
505 | 496 |
506 // Allow tests to wake up when certain events occur. | |
507 WatchEventCallback watch_event_callback_; | |
508 subtle::AtomicWord /* const unsigned char* */ watch_category_; | |
509 std::string watch_event_name_; | |
510 | |
511 subtle::AtomicWord /* Options */ trace_options_; | 497 subtle::AtomicWord /* Options */ trace_options_; |
512 | 498 |
513 TraceConfig trace_config_; | 499 TraceConfig trace_config_; |
514 TraceConfig::EventFilters enabled_event_filters_; | 500 TraceConfig::EventFilters enabled_event_filters_; |
515 | 501 |
516 ThreadLocalPointer<ThreadLocalEventBuffer> thread_local_event_buffer_; | 502 ThreadLocalPointer<ThreadLocalEventBuffer> thread_local_event_buffer_; |
517 ThreadLocalBoolean thread_blocks_message_loop_; | 503 ThreadLocalBoolean thread_blocks_message_loop_; |
518 ThreadLocalBoolean thread_is_in_trace_event_; | 504 ThreadLocalBoolean thread_is_in_trace_event_; |
519 | 505 |
520 // Contains the message loops of threads that have had at least one event | 506 // Contains the message loops of threads that have had at least one event |
(...skipping 13 matching lines...) Expand all Loading... |
534 subtle::AtomicWord generation_; | 520 subtle::AtomicWord generation_; |
535 bool use_worker_thread_; | 521 bool use_worker_thread_; |
536 | 522 |
537 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 523 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
538 }; | 524 }; |
539 | 525 |
540 } // namespace trace_event | 526 } // namespace trace_event |
541 } // namespace base | 527 } // namespace base |
542 | 528 |
543 #endif // BASE_TRACE_EVENT_TRACE_LOG_H_ | 529 #endif // BASE_TRACE_EVENT_TRACE_LOG_H_ |
OLD | NEW |