| 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 // This file contains the Windows-specific exporting to ETW. | 5 // This file contains the Windows-specific exporting to ETW. |
| 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ | 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ |
| 7 #define BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ | 7 #define BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 int num_args, | 49 int num_args, |
| 50 const char** arg_names, | 50 const char** arg_names, |
| 51 const unsigned char* arg_types, | 51 const unsigned char* arg_types, |
| 52 const unsigned long long* arg_values, | 52 const unsigned long long* arg_values, |
| 53 const std::unique_ptr<ConvertableToTraceFormat>* convertable_values); | 53 const std::unique_ptr<ConvertableToTraceFormat>* convertable_values); |
| 54 | 54 |
| 55 // Exports an ETW event that marks the end of a complete event. | 55 // Exports an ETW event that marks the end of a complete event. |
| 56 static void AddCompleteEndEvent(const char* name); | 56 static void AddCompleteEndEvent(const char* name); |
| 57 | 57 |
| 58 // Returns true if any category in the group is enabled. | 58 // Returns true if any category in the group is enabled. |
| 59 static bool IsCategoryGroupEnabled(const char* category_group_name); | 59 static bool IsCategoryGroupEnabled(StringPiece category_group_name); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 // Ensure only the provider can construct us. | 62 // Ensure only the provider can construct us. |
| 63 friend struct StaticMemorySingletonTraits<TraceEventETWExport>; | 63 friend struct StaticMemorySingletonTraits<TraceEventETWExport>; |
| 64 // To have access to UpdateKeyword(). | 64 // To have access to UpdateKeyword(). |
| 65 class ETWKeywordUpdateThread; | 65 class ETWKeywordUpdateThread; |
| 66 TraceEventETWExport(); | 66 TraceEventETWExport(); |
| 67 | 67 |
| 68 // Updates the list of enabled categories by consulting the ETW keyword. | 68 // Updates the list of enabled categories by consulting the ETW keyword. |
| 69 // Returns true if there was a change, false otherwise. | 69 // Returns true if there was a change, false otherwise. |
| 70 bool UpdateEnabledCategories(); | 70 bool UpdateEnabledCategories(); |
| 71 | 71 |
| 72 // Returns true if the category is enabled. | 72 // Returns true if the category is enabled. |
| 73 bool IsCategoryEnabled(const char* category_name) const; | 73 bool IsCategoryEnabled(StringPiece category_name) const; |
| 74 | 74 |
| 75 // Called back by the update thread to check for potential changes to the | 75 // Called back by the update thread to check for potential changes to the |
| 76 // keyword. | 76 // keyword. |
| 77 static void UpdateETWKeyword(); | 77 static void UpdateETWKeyword(); |
| 78 | 78 |
| 79 // True if ETW is enabled. Allows hiding the exporting behind a flag. | 79 // True if ETW is enabled. Allows hiding the exporting behind a flag. |
| 80 bool etw_export_enabled_; | 80 bool etw_export_enabled_; |
| 81 | 81 |
| 82 // Maps category names to their status (enabled/disabled). | 82 // Maps category names to their status (enabled/disabled). |
| 83 std::map<StringPiece, bool> categories_status_; | 83 std::map<StringPiece, bool> categories_status_; |
| 84 | 84 |
| 85 // Local copy of the ETW keyword. | 85 // Local copy of the ETW keyword. |
| 86 uint64_t etw_match_any_keyword_; | 86 uint64_t etw_match_any_keyword_; |
| 87 | 87 |
| 88 // Background thread that monitors changes to the ETW keyword and updates | 88 // Background thread that monitors changes to the ETW keyword and updates |
| 89 // the enabled categories when a change occurs. | 89 // the enabled categories when a change occurs. |
| 90 std::unique_ptr<ETWKeywordUpdateThread> keyword_update_thread_; | 90 std::unique_ptr<ETWKeywordUpdateThread> keyword_update_thread_; |
| 91 PlatformThreadHandle keyword_update_thread_handle_; | 91 PlatformThreadHandle keyword_update_thread_handle_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(TraceEventETWExport); | 93 DISALLOW_COPY_AND_ASSIGN(TraceEventETWExport); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace trace_event | 96 } // namespace trace_event |
| 97 } // namespace base | 97 } // namespace base |
| 98 | 98 |
| 99 #endif // BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ | 99 #endif // BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ |
| OLD | NEW |