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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 TraceEventHandle handle); | 274 TraceEventHandle handle); |
275 | 275 |
276 int process_id() const { return process_id_; } | 276 int process_id() const { return process_id_; } |
277 | 277 |
278 uint64_t MangleEventId(uint64_t id); | 278 uint64_t MangleEventId(uint64_t id); |
279 | 279 |
280 // Exposed for unittesting: | 280 // Exposed for unittesting: |
281 | 281 |
282 // Testing factory for TraceEventFilter. | 282 // Testing factory for TraceEventFilter. |
283 typedef std::unique_ptr<TraceEventFilter> (*FilterFactoryForTesting)( | 283 typedef std::unique_ptr<TraceEventFilter> (*FilterFactoryForTesting)( |
284 const std::string& /* predicate_name */); | 284 const std::string& /* predicate_name */, |
| 285 std::unique_ptr<TraceEventFilter::Config>); |
285 void SetFilterFactoryForTesting(FilterFactoryForTesting factory) { | 286 void SetFilterFactoryForTesting(FilterFactoryForTesting factory) { |
286 filter_factory_for_testing_ = factory; | 287 filter_factory_for_testing_ = factory; |
287 } | 288 } |
288 | 289 |
289 // Allows deleting our singleton instance. | 290 // Allows deleting our singleton instance. |
290 static void DeleteForTesting(); | 291 static void DeleteForTesting(); |
291 | 292 |
292 // Allow tests to inspect TraceEvents. | 293 // Allow tests to inspect TraceEvents. |
293 TraceEvent* GetEventByHandle(TraceEventHandle handle); | 294 TraceEvent* GetEventByHandle(TraceEventHandle handle); |
294 | 295 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 349 |
349 // This allows constructor and destructor to be private and usable only | 350 // This allows constructor and destructor to be private and usable only |
350 // by the Singleton class. | 351 // by the Singleton class. |
351 friend struct DefaultSingletonTraits<TraceLog>; | 352 friend struct DefaultSingletonTraits<TraceLog>; |
352 | 353 |
353 // MemoryDumpProvider implementation. | 354 // MemoryDumpProvider implementation. |
354 bool OnMemoryDump(const MemoryDumpArgs& args, | 355 bool OnMemoryDump(const MemoryDumpArgs& args, |
355 ProcessMemoryDump* pmd) override; | 356 ProcessMemoryDump* pmd) override; |
356 | 357 |
357 // Enable/disable each category group based on the current mode_, | 358 // Enable/disable each category group based on the current mode_, |
358 // category_filter_ and event_filters_enabled_. | 359 // category_filter_ and state of event filters. |
359 // Enable the category group in the recording mode if category_filter_ matches | 360 void UpdateCategoryRegistry(); |
| 361 |
| 362 // Enable the category in the recording mode if trace config matches |
360 // the category group, is not null. Enable category for filtering if any | 363 // the category group, is not null. Enable category for filtering if any |
361 // filter in event_filters_enabled_ enables it. | 364 // filter in event_filters_enabled_ enables it. |
362 void UpdateCategoryRegistry(); | |
363 void UpdateCategoryState(TraceCategory* category); | 365 void UpdateCategoryState(TraceCategory* category); |
364 | 366 |
365 void CreateFiltersForTraceConfig(); | 367 // Registers new TraceEventFilter(s) based on the current |trace_config_|. |
| 368 void CreateFiltersAndUpdateFilterRegistry(); |
366 | 369 |
367 // Configure synthetic delays based on the values set in the current | 370 // Configure synthetic delays based on the values set in the current |
368 // trace config. | 371 // trace config. |
369 void UpdateSyntheticDelaysFromTraceConfig(); | 372 void UpdateSyntheticDelaysFromTraceConfig(); |
370 | 373 |
371 InternalTraceOptions GetInternalOptionsFromTraceConfig( | 374 InternalTraceOptions GetInternalOptionsFromTraceConfig( |
372 const TraceConfig& config); | 375 const TraceConfig& config); |
373 | 376 |
374 class ThreadLocalEventBuffer; | 377 class ThreadLocalEventBuffer; |
375 class OptionalAutoLock; | 378 class OptionalAutoLock; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 // XORed with TraceID to make it unlikely to collide with other processes. | 469 // XORed with TraceID to make it unlikely to collide with other processes. |
467 unsigned long long process_id_hash_; | 470 unsigned long long process_id_hash_; |
468 | 471 |
469 int process_id_; | 472 int process_id_; |
470 | 473 |
471 TimeDelta time_offset_; | 474 TimeDelta time_offset_; |
472 | 475 |
473 subtle::AtomicWord /* Options */ trace_options_; | 476 subtle::AtomicWord /* Options */ trace_options_; |
474 | 477 |
475 TraceConfig trace_config_; | 478 TraceConfig trace_config_; |
476 TraceConfig::EventFilters enabled_event_filters_; | |
477 | 479 |
478 ThreadLocalPointer<ThreadLocalEventBuffer> thread_local_event_buffer_; | 480 ThreadLocalPointer<ThreadLocalEventBuffer> thread_local_event_buffer_; |
479 ThreadLocalBoolean thread_blocks_message_loop_; | 481 ThreadLocalBoolean thread_blocks_message_loop_; |
480 ThreadLocalBoolean thread_is_in_trace_event_; | 482 ThreadLocalBoolean thread_is_in_trace_event_; |
481 | 483 |
482 // Contains the message loops of threads that have had at least one event | 484 // Contains the message loops of threads that have had at least one event |
483 // added into the local event buffer. Not using SingleThreadTaskRunner | 485 // added into the local event buffer. Not using SingleThreadTaskRunner |
484 // because we need to know the life time of the message loops. | 486 // because we need to know the life time of the message loops. |
485 hash_set<MessageLoop*> thread_message_loops_; | 487 hash_set<MessageLoop*> thread_message_loops_; |
486 | 488 |
(...skipping 11 matching lines...) Expand all Loading... |
498 | 500 |
499 FilterFactoryForTesting filter_factory_for_testing_; | 501 FilterFactoryForTesting filter_factory_for_testing_; |
500 | 502 |
501 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 503 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
502 }; | 504 }; |
503 | 505 |
504 } // namespace trace_event | 506 } // namespace trace_event |
505 } // namespace base | 507 } // namespace base |
506 | 508 |
507 #endif // BASE_TRACE_EVENT_TRACE_LOG_H_ | 509 #endif // BASE_TRACE_EVENT_TRACE_LOG_H_ |
OLD | NEW |