Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: base/trace_event/trace_event_impl.h

Issue 1038453002: Add option to export tracing events to ETW. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thakis@ and thestig@ reviews. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
8 8
9 #include <stack> 9 #include <stack>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/atomicops.h" 13 #include "base/atomicops.h"
14 #include "base/base_export.h" 14 #include "base/base_export.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/memory/ref_counted_memory.h" 18 #include "base/memory/ref_counted_memory.h"
19 #include "base/memory/scoped_vector.h" 19 #include "base/memory/scoped_vector.h"
20 #include "base/observer_list.h" 20 #include "base/observer_list.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/synchronization/condition_variable.h" 22 #include "base/synchronization/condition_variable.h"
23 #include "base/synchronization/lock.h" 23 #include "base/synchronization/lock.h"
24 #include "base/threading/thread.h" 24 #include "base/threading/thread.h"
25 #include "base/threading/thread_local.h" 25 #include "base/threading/thread_local.h"
26 26
27 // Older style trace macros with explicit id and extra data 27 // Older style trace macros with explicit id and extra data
28 // Only these macros result in publishing data to ETW as currently implemented. 28 // Only these macros result in publishing data to ETW as currently implemented.
29 // TODO(georgesak): Update/replace these with new ETW macros.
29 #define TRACE_EVENT_BEGIN_ETW(name, id, extra) \ 30 #define TRACE_EVENT_BEGIN_ETW(name, id, extra) \
30 base::trace_event::TraceLog::AddTraceEventEtw( \ 31 base::trace_event::TraceLog::AddTraceEventEtw( \
31 TRACE_EVENT_PHASE_BEGIN, \ 32 TRACE_EVENT_PHASE_BEGIN, \
32 name, reinterpret_cast<const void*>(id), extra) 33 name, reinterpret_cast<const void*>(id), extra)
33 34
34 #define TRACE_EVENT_END_ETW(name, id, extra) \ 35 #define TRACE_EVENT_END_ETW(name, id, extra) \
35 base::trace_event::TraceLog::AddTraceEventEtw( \ 36 base::trace_event::TraceLog::AddTraceEventEtw( \
36 TRACE_EVENT_PHASE_END, \ 37 TRACE_EVENT_PHASE_END, \
37 name, reinterpret_cast<const void*>(id), extra) 38 name, reinterpret_cast<const void*>(id), extra)
38 39
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // value with zero or more of the following bits. Used in this class only. 440 // value with zero or more of the following bits. Used in this class only.
440 // The TRACE_EVENT macros should only use the value as a bool. 441 // The TRACE_EVENT macros should only use the value as a bool.
441 // These values must be in sync with macro values in TraceEvent.h in Blink. 442 // These values must be in sync with macro values in TraceEvent.h in Blink.
442 enum CategoryGroupEnabledFlags { 443 enum CategoryGroupEnabledFlags {
443 // Category group enabled for the recording mode. 444 // Category group enabled for the recording mode.
444 ENABLED_FOR_RECORDING = 1 << 0, 445 ENABLED_FOR_RECORDING = 1 << 0,
445 // Category group enabled for the monitoring mode. 446 // Category group enabled for the monitoring mode.
446 ENABLED_FOR_MONITORING = 1 << 1, 447 ENABLED_FOR_MONITORING = 1 << 1,
447 // Category group enabled by SetEventCallbackEnabled(). 448 // Category group enabled by SetEventCallbackEnabled().
448 ENABLED_FOR_EVENT_CALLBACK = 1 << 2, 449 ENABLED_FOR_EVENT_CALLBACK = 1 << 2,
450 // Category group enabled to export events to ETW.
451 ENABLED_FOR_ETW_EXPORT = 1 << 3
449 }; 452 };
450 453
451 static TraceLog* GetInstance(); 454 static TraceLog* GetInstance();
452 455
453 // Get set of known category groups. This can change as new code paths are 456 // Get set of known category groups. This can change as new code paths are
454 // reached. The known category groups are inserted into |category_groups|. 457 // reached. The known category groups are inserted into |category_groups|.
455 void GetKnownCategoryGroups(std::vector<std::string>* category_groups); 458 void GetKnownCategoryGroups(std::vector<std::string>* category_groups);
456 459
457 // Retrieves a copy (for thread-safety) of the current CategoryFilter. 460 // Retrieves a copy (for thread-safety) of the current CategoryFilter.
458 CategoryFilter GetCurrentCategoryFilter(); 461 CategoryFilter GetCurrentCategoryFilter();
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; 807 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_;
805 subtle::AtomicWord generation_; 808 subtle::AtomicWord generation_;
806 809
807 DISALLOW_COPY_AND_ASSIGN(TraceLog); 810 DISALLOW_COPY_AND_ASSIGN(TraceLog);
808 }; 811 };
809 812
810 } // namespace trace_event 813 } // namespace trace_event
811 } // namespace base 814 } // namespace base
812 815
813 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 816 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698