| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 // Register the ETW provider. If registration fails then the event logging | 171 // Register the ETW provider. If registration fails then the event logging |
| 172 // calls will fail (on XP this call will do nothing). | 172 // calls will fail (on XP this call will do nothing). |
| 173 EventRegisterChrome(); | 173 EventRegisterChrome(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 // Make sure to initialize the map with all the group names. Subsequent | 176 // Make sure to initialize the map with all the group names. Subsequent |
| 177 // modifications will be made by the background thread and only affect the | 177 // modifications will be made by the background thread and only affect the |
| 178 // values of the keys (no key addition/deletion). Therefore, the map does not | 178 // values of the keys (no key addition/deletion). Therefore, the map does not |
| 179 // require a lock for access. | 179 // require a lock for access. |
| 180 for (int i = 0; i < ARRAYSIZE(kFilteredEventGroupNames); i++) | 180 for (size_t i = 0; i < ARRAYSIZE(kFilteredEventGroupNames); i++) |
| 181 categories_status_[kFilteredEventGroupNames[i]] = false; | 181 categories_status_[kFilteredEventGroupNames[i]] = false; |
| 182 categories_status_[kOtherEventsGroupName] = false; | 182 categories_status_[kOtherEventsGroupName] = false; |
| 183 categories_status_[kDisabledOtherEventsGroupName] = false; | 183 categories_status_[kDisabledOtherEventsGroupName] = false; |
| 184 DCHECK_EQ(kNumberOfCategories, categories_status_.size()); | 184 DCHECK_EQ(kNumberOfCategories, categories_status_.size()); |
| 185 } | 185 } |
| 186 | 186 |
| 187 TraceEventETWExport::~TraceEventETWExport() { | 187 TraceEventETWExport::~TraceEventETWExport() { |
| 188 EventUnregisterChrome(); | 188 EventUnregisterChrome(); |
| 189 } | 189 } |
| 190 | 190 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 bool TraceEventETWExport::UpdateEnabledCategories() { | 370 bool TraceEventETWExport::UpdateEnabledCategories() { |
| 371 if (etw_match_any_keyword_ == CHROME_Context.MatchAnyKeyword) | 371 if (etw_match_any_keyword_ == CHROME_Context.MatchAnyKeyword) |
| 372 return false; | 372 return false; |
| 373 | 373 |
| 374 // If the keyword has changed, update each category. | 374 // If the keyword has changed, update each category. |
| 375 // Chrome_Context.MatchAnyKeyword is set by UIforETW (or other ETW trace | 375 // Chrome_Context.MatchAnyKeyword is set by UIforETW (or other ETW trace |
| 376 // recording tools) using the ETW infrastructure. This value will be set in | 376 // recording tools) using the ETW infrastructure. This value will be set in |
| 377 // all Chrome processes that have registered their ETW provider. | 377 // all Chrome processes that have registered their ETW provider. |
| 378 etw_match_any_keyword_ = CHROME_Context.MatchAnyKeyword; | 378 etw_match_any_keyword_ = CHROME_Context.MatchAnyKeyword; |
| 379 for (int i = 0; i < ARRAYSIZE(kFilteredEventGroupNames); i++) { | 379 for (size_t i = 0; i < ARRAYSIZE(kFilteredEventGroupNames); i++) { |
| 380 if (etw_match_any_keyword_ & (1ULL << i)) { | 380 if (etw_match_any_keyword_ & (1ULL << i)) { |
| 381 categories_status_[kFilteredEventGroupNames[i]] = true; | 381 categories_status_[kFilteredEventGroupNames[i]] = true; |
| 382 } else { | 382 } else { |
| 383 categories_status_[kFilteredEventGroupNames[i]] = false; | 383 categories_status_[kFilteredEventGroupNames[i]] = false; |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 // Also update the two default categories. | 387 // Also update the two default categories. |
| 388 if (etw_match_any_keyword_ & kOtherEventsKeywordBit) { | 388 if (etw_match_any_keyword_ & kOtherEventsKeywordBit) { |
| 389 categories_status_[kOtherEventsGroupName] = true; | 389 categories_status_[kOtherEventsGroupName] = true; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 // static | 427 // static |
| 428 void TraceEventETWExport::UpdateETWKeyword() { | 428 void TraceEventETWExport::UpdateETWKeyword() { |
| 429 if (!IsETWExportEnabled()) | 429 if (!IsETWExportEnabled()) |
| 430 return; | 430 return; |
| 431 auto* instance = GetInstance(); | 431 auto* instance = GetInstance(); |
| 432 DCHECK(instance); | 432 DCHECK(instance); |
| 433 instance->UpdateEnabledCategories(); | 433 instance->UpdateEnabledCategories(); |
| 434 } | 434 } |
| 435 } // namespace trace_event | 435 } // namespace trace_event |
| 436 } // namespace base | 436 } // namespace base |
| OLD | NEW |