| 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 #include "base/trace_event/trace_event_etw_export_win.h" | 5 #include "base/trace_event/trace_event_etw_export_win.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return EventUnregisterProc(RegHandle); | 126 return EventUnregisterProc(RegHandle); |
| 127 return 0; | 127 return 0; |
| 128 } | 128 } |
| 129 | 129 |
| 130 namespace base { | 130 namespace base { |
| 131 namespace trace_event { | 131 namespace trace_event { |
| 132 | 132 |
| 133 // This object will be created by each process. It's a background (low-priority) | 133 // This object will be created by each process. It's a background (low-priority) |
| 134 // thread that will monitor the ETW keyword for any changes. | 134 // thread that will monitor the ETW keyword for any changes. |
| 135 class TraceEventETWExport::ETWKeywordUpdateThread | 135 class TraceEventETWExport::ETWKeywordUpdateThread |
| 136 : public base::PlatformThread::Delegate { | 136 : public PlatformThread::Delegate { |
| 137 public: | 137 public: |
| 138 ETWKeywordUpdateThread() {} | 138 ETWKeywordUpdateThread() {} |
| 139 ~ETWKeywordUpdateThread() override {} | 139 ~ETWKeywordUpdateThread() override {} |
| 140 | 140 |
| 141 // Implementation of PlatformThread::Delegate: | 141 // Implementation of PlatformThread::Delegate: |
| 142 void ThreadMain() override { | 142 void ThreadMain() override { |
| 143 base::PlatformThread::SetName("ETW Keyword Update Thread"); | 143 PlatformThread::SetName("ETW Keyword Update Thread"); |
| 144 base::TimeDelta sleep_time = | 144 TimeDelta sleep_time = TimeDelta::FromMilliseconds(kUpdateTimerDelayMs); |
| 145 base::TimeDelta::FromMilliseconds(kUpdateTimerDelayMs); | |
| 146 while (1) { | 145 while (1) { |
| 147 base::PlatformThread::Sleep(sleep_time); | 146 PlatformThread::Sleep(sleep_time); |
| 148 base::trace_event::TraceEventETWExport::UpdateETWKeyword(); | 147 trace_event::TraceEventETWExport::UpdateETWKeyword(); |
| 149 } | 148 } |
| 150 } | 149 } |
| 151 | 150 |
| 152 private: | 151 private: |
| 153 // Time between checks for ETW keyword changes (in milliseconds). | 152 // Time between checks for ETW keyword changes (in milliseconds). |
| 154 unsigned int kUpdateTimerDelayMs = 1000; | 153 unsigned int kUpdateTimerDelayMs = 1000; |
| 155 }; | 154 }; |
| 156 | 155 |
| 157 | 156 |
| 158 TraceEventETWExport::TraceEventETWExport() | 157 TraceEventETWExport::TraceEventETWExport() |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // static | 434 // static |
| 436 void TraceEventETWExport::UpdateETWKeyword() { | 435 void TraceEventETWExport::UpdateETWKeyword() { |
| 437 if (!IsETWExportEnabled()) | 436 if (!IsETWExportEnabled()) |
| 438 return; | 437 return; |
| 439 auto* instance = GetInstance(); | 438 auto* instance = GetInstance(); |
| 440 DCHECK(instance); | 439 DCHECK(instance); |
| 441 instance->UpdateEnabledCategories(); | 440 instance->UpdateEnabledCategories(); |
| 442 } | 441 } |
| 443 } // namespace trace_event | 442 } // namespace trace_event |
| 444 } // namespace base | 443 } // namespace base |
| OLD | NEW |