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

Side by Side Diff: base/trace_event/trace_log.cc

Issue 2323483005: [tracing] Add filtering mode in TraceLog (Closed)
Patch Set: SetEnabled takes a bitmap. Created 4 years, 2 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
« base/trace_event/trace_log.h ('K') | « base/trace_event/trace_log.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_log.h" 5 #include "base/trace_event/trace_log.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 TraceLogStatus::TraceLogStatus() : event_capacity(0), event_count(0) {} 455 TraceLogStatus::TraceLogStatus() : event_capacity(0), event_count(0) {}
456 456
457 TraceLogStatus::~TraceLogStatus() {} 457 TraceLogStatus::~TraceLogStatus() {}
458 458
459 // static 459 // static
460 TraceLog* TraceLog::GetInstance() { 460 TraceLog* TraceLog::GetInstance() {
461 return Singleton<TraceLog, LeakySingletonTraits<TraceLog>>::get(); 461 return Singleton<TraceLog, LeakySingletonTraits<TraceLog>>::get();
462 } 462 }
463 463
464 TraceLog::TraceLog() 464 TraceLog::TraceLog()
465 : mode_(DISABLED), 465 : enabled_modes_(0),
466 num_traces_recorded_(0), 466 num_traces_recorded_(0),
467 event_callback_(0), 467 event_callback_(0),
468 dispatching_to_observer_list_(false), 468 dispatching_to_observer_list_(false),
469 process_sort_index_(0), 469 process_sort_index_(0),
470 process_id_hash_(0), 470 process_id_hash_(0),
471 process_id_(0), 471 process_id_(0),
472 watch_category_(0), 472 watch_category_(0),
473 trace_options_(kInternalRecordUntilFull), 473 trace_options_(kInternalRecordUntilFull),
474 trace_config_(TraceConfig()), 474 trace_config_(TraceConfig()),
475 event_callback_trace_config_(TraceConfig()), 475 event_callback_trace_config_(TraceConfig()),
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 553 }
554 554
555 const char* TraceLog::GetCategoryGroupName( 555 const char* TraceLog::GetCategoryGroupName(
556 const unsigned char* category_group_enabled) { 556 const unsigned char* category_group_enabled) {
557 return g_category_groups[GetCategoryIndex(category_group_enabled)]; 557 return g_category_groups[GetCategoryIndex(category_group_enabled)];
558 } 558 }
559 559
560 void TraceLog::UpdateCategoryGroupEnabledFlag(size_t category_index) { 560 void TraceLog::UpdateCategoryGroupEnabledFlag(size_t category_index) {
561 unsigned char enabled_flag = 0; 561 unsigned char enabled_flag = 0;
562 const char* category_group = g_category_groups[category_index]; 562 const char* category_group = g_category_groups[category_index];
563 if (mode_ == RECORDING_MODE && 563 if (enabled_modes_ & RECORDING_MODE &&
564 trace_config_.IsCategoryGroupEnabled(category_group)) { 564 trace_config_.IsCategoryGroupEnabled(category_group)) {
565 enabled_flag |= ENABLED_FOR_RECORDING; 565 enabled_flag |= ENABLED_FOR_RECORDING;
566 } 566 }
567 567
568 if (event_callback_ && 568 if (event_callback_ &&
569 event_callback_trace_config_.IsCategoryGroupEnabled(category_group)) { 569 event_callback_trace_config_.IsCategoryGroupEnabled(category_group)) {
570 enabled_flag |= ENABLED_FOR_EVENT_CALLBACK; 570 enabled_flag |= ENABLED_FOR_EVENT_CALLBACK;
Primiano Tucci (use gerrit) 2016/10/12 17:50:17 I thought ENABLED_FOR_EVENT_CALLBACK was gone? or
ssid 2016/10/12 19:04:44 Sorry, i still did not land that one. that is wait
571 } 571 }
572 572
573 #if defined(OS_WIN) 573 #if defined(OS_WIN)
574 if (base::trace_event::TraceEventETWExport::IsCategoryGroupEnabled( 574 if (base::trace_event::TraceEventETWExport::IsCategoryGroupEnabled(
575 category_group)) { 575 category_group)) {
576 enabled_flag |= ENABLED_FOR_ETW_EXPORT; 576 enabled_flag |= ENABLED_FOR_ETW_EXPORT;
577 } 577 }
578 #endif 578 #endif
579 579
580 // TODO(primiano): this is a temporary workaround for catapult:#2341, 580 // TODO(primiano): this is a temporary workaround for catapult:#2341,
581 // to guarantee that metadata events are always added even if the category 581 // to guarantee that metadata events are always added even if the category
582 // filter is "-*". See crbug.com/618054 for more details and long-term fix. 582 // filter is "-*". See crbug.com/618054 for more details and long-term fix.
583 if (mode_ == RECORDING_MODE && !strcmp(category_group, "__metadata")) 583 if (enabled_modes_ & RECORDING_MODE && !strcmp(category_group, "__metadata"))
584 enabled_flag |= ENABLED_FOR_RECORDING; 584 enabled_flag |= ENABLED_FOR_RECORDING;
585 585
586 uint32_t enabled_filters_bitmap = 0; 586 uint32_t enabled_filters_bitmap = 0;
587 int index = 0; 587 int index = 0;
588 for (const auto& event_filter : trace_config_.event_filters()) { 588 for (const auto& event_filter : event_filters_enabled_) {
589 if (event_filter.IsCategoryGroupEnabled(category_group)) { 589 if (event_filter.IsCategoryGroupEnabled(category_group)) {
590 enabled_flag |= ENABLED_FOR_FILTERING; 590 enabled_flag |= ENABLED_FOR_FILTERING;
591 DCHECK(g_category_group_filters.Get()[index]); 591 DCHECK(g_category_group_filters.Get()[index]);
592 enabled_filters_bitmap |= 1 << index; 592 enabled_filters_bitmap |= 1 << index;
593 } 593 }
594 if (index++ >= MAX_TRACE_EVENT_FILTERS) { 594 if (index++ >= MAX_TRACE_EVENT_FILTERS) {
595 NOTREACHED(); 595 NOTREACHED();
596 break; 596 break;
597 } 597 }
598 } 598 }
599 g_category_group_filters_enabled[category_index] = enabled_filters_bitmap; 599 g_category_group_filters_enabled[category_index] = enabled_filters_bitmap;
600 600
601 g_category_group_enabled[category_index] = enabled_flag; 601 g_category_group_enabled[category_index] = enabled_flag;
602 } 602 }
603 603
604 void TraceLog::UpdateCategoryGroupEnabledFlags() { 604 void TraceLog::UpdateCategoryGroupEnabledFlags() {
605 CreateFiltersForTraceConfig(); 605 CreateFiltersForTraceConfig();
606 size_t category_index = base::subtle::NoBarrier_Load(&g_category_index); 606 size_t category_index = base::subtle::NoBarrier_Load(&g_category_index);
607 for (size_t i = 0; i < category_index; i++) 607 for (size_t i = 0; i < category_index; i++)
608 UpdateCategoryGroupEnabledFlag(i); 608 UpdateCategoryGroupEnabledFlag(i);
609 } 609 }
610 610
611 void TraceLog::CreateFiltersForTraceConfig() { 611 void TraceLog::CreateFiltersForTraceConfig() {
612 if (!enabled_modes_ & FILTERING_MODE)
Primiano Tucci (use gerrit) 2016/10/12 17:50:17 watch out operator orders, here you really want i
ssid 2016/10/12 19:04:44 yes, i was going to fix this.
613 return;
614
612 // Filters were already added and tracing could be enabled. Filters list 615 // Filters were already added and tracing could be enabled. Filters list
613 // cannot be changed when trace events are using them. 616 // cannot be changed when trace events are using them.
614 if (g_category_group_filters.Get().size()) 617 if (g_category_group_filters.Get().size())
615 return; 618 return;
616 619
617 for (auto& event_filter : trace_config_.event_filters()) { 620 for (auto& event_filter : event_filters_enabled_) {
618 if (g_category_group_filters.Get().size() >= MAX_TRACE_EVENT_FILTERS) { 621 if (g_category_group_filters.Get().size() >= MAX_TRACE_EVENT_FILTERS) {
619 NOTREACHED() 622 NOTREACHED()
620 << "Too many trace event filters installed in the current session"; 623 << "Too many trace event filters installed in the current session";
621 break; 624 break;
622 } 625 }
623 626
624 std::unique_ptr<TraceEventFilter> new_filter; 627 std::unique_ptr<TraceEventFilter> new_filter;
625 if (event_filter.predicate_name() == 628 if (event_filter.predicate_name() ==
626 TraceEventFilter::kEventWhitelistPredicate) { 629 TraceEventFilter::kEventWhitelistPredicate) {
627 new_filter = MakeUnique<EventNameFilter>(event_filter.filter_args()); 630 new_filter = MakeUnique<EventNameFilter>(event_filter.filter_args());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 } 723 }
721 724
722 void TraceLog::GetKnownCategoryGroups( 725 void TraceLog::GetKnownCategoryGroups(
723 std::vector<std::string>* category_groups) { 726 std::vector<std::string>* category_groups) {
724 AutoLock lock(lock_); 727 AutoLock lock(lock_);
725 size_t category_index = base::subtle::NoBarrier_Load(&g_category_index); 728 size_t category_index = base::subtle::NoBarrier_Load(&g_category_index);
726 for (size_t i = kNumBuiltinCategories; i < category_index; i++) 729 for (size_t i = kNumBuiltinCategories; i < category_index; i++)
727 category_groups->push_back(g_category_groups[i]); 730 category_groups->push_back(g_category_groups[i]);
728 } 731 }
729 732
730 void TraceLog::SetEnabled(const TraceConfig& trace_config, Mode mode) { 733 void TraceLog::SetEnabled(const TraceConfig& trace_config, uint8_t modes) {
731 std::vector<EnabledStateObserver*> observer_list; 734 std::vector<EnabledStateObserver*> observer_list;
732 std::map<AsyncEnabledStateObserver*, RegisteredAsyncObserver> observer_map; 735 std::map<AsyncEnabledStateObserver*, RegisteredAsyncObserver> observer_map;
733 { 736 {
734 AutoLock lock(lock_); 737 AutoLock lock(lock_);
735 738
736 // Can't enable tracing when Flush() is in progress. 739 // Can't enable tracing when Flush() is in progress.
737 DCHECK(!flush_task_runner_); 740 DCHECK(!flush_task_runner_);
738 741
739 InternalTraceOptions new_options = 742 InternalTraceOptions new_options =
740 GetInternalOptionsFromTraceConfig(trace_config); 743 GetInternalOptionsFromTraceConfig(trace_config);
741 744
742 InternalTraceOptions old_options = trace_options(); 745 InternalTraceOptions old_options = trace_options();
743 746
744 if (IsEnabled()) {
745 if (new_options != old_options) {
746 DLOG(ERROR) << "Attempting to re-enable tracing with a different "
747 << "set of options.";
748 }
749
750 if (mode != mode_) {
751 DLOG(ERROR) << "Attempting to re-enable tracing with a different mode.";
752 }
753
754 DCHECK(!trace_config.event_filters().size())
755 << "Adding new filters while tracing was already enabled is not "
756 "supported.";
757
758 trace_config_.Merge(trace_config);
759 UpdateCategoryGroupEnabledFlags();
760 return;
761 }
762
763 if (dispatching_to_observer_list_) { 747 if (dispatching_to_observer_list_) {
764 DLOG(ERROR) 748 NOTREACHED()
765 << "Cannot manipulate TraceLog::Enabled state from an observer."; 749 << "Cannot manipulate TraceLog::Enabled state from an observer.";
766 return; 750 return;
767 } 751 }
768 752
769 mode_ = mode; 753 // Clear all filters from previous tracing session. These filters are not
754 // cleared at the end of tracing because some threads which hit trace event
755 // when disabling, could try to use the filters.
756 if (!enabled_modes_)
757 g_category_group_filters.Get().clear();
758
759 // Update trace config for recording.
760 bool already_recording = enabled_modes_ & RECORDING_MODE;
Primiano Tucci (use gerrit) 2016/10/12 17:50:17 +const (const bool)
ssid 2016/10/12 19:04:44 Done.
761 if (modes & RECORDING_MODE) {
762 if (already_recording) {
763 DCHECK_EQ(new_options, old_options) << "Attempting to re-enable "
764 "tracing with a different set "
765 "of options.";
766 trace_config_.Merge(trace_config);
767 } else {
768 trace_config_ = trace_config;
769 }
770 }
771
772 // Update event filters.
773 if (modes & FILTERING_MODE) {
774 DCHECK(!trace_config.event_filters().empty())
775 << "Attempting to enable filtering without any filters";
776 DCHECK(event_filters_enabled_.empty()) << "Attempting to re-enable "
777 "filtering when filters are "
778 "already enabled.";
779
780 // Use the given event filters only if filtering was not enabled.
781 if (event_filters_enabled_.empty())
782 event_filters_enabled_ = trace_config.event_filters();
783 }
784 // Keep the |trace_config_| updated with only enabled filters in case anyone
785 // tries to read it using |GetCurrentTraceConfig| (even if filters are
786 // empty).
787 trace_config_.SetEventFilterConfigs(event_filters_enabled_);
788
789 enabled_modes_ |= modes;
790 UpdateCategoryGroupEnabledFlags();
791
792 // Do not notify observers or create trace buffer if only enabled for
793 // filtering or if recording was already enabled.
794 if (!(modes & RECORDING_MODE) || already_recording)
795 return;
770 796
771 if (new_options != old_options) { 797 if (new_options != old_options) {
772 subtle::NoBarrier_Store(&trace_options_, new_options); 798 subtle::NoBarrier_Store(&trace_options_, new_options);
773 UseNextTraceBuffer(); 799 UseNextTraceBuffer();
774 } 800 }
775 801
776 num_traces_recorded_++; 802 num_traces_recorded_++;
777 803
778 // Clear all filters from previous tracing session. These filters are not
779 // cleared at the end of tracing because some threads which hit trace event
780 // when disabling, could try to use the filters.
781 g_category_group_filters.Get().clear();
782
783 trace_config_ = TraceConfig(trace_config);
784 UpdateCategoryGroupEnabledFlags(); 804 UpdateCategoryGroupEnabledFlags();
785 UpdateSyntheticDelaysFromTraceConfig(); 805 UpdateSyntheticDelaysFromTraceConfig();
786 806
787 dispatching_to_observer_list_ = true; 807 dispatching_to_observer_list_ = true;
788 observer_list = enabled_state_observer_list_; 808 observer_list = enabled_state_observer_list_;
789 observer_map = async_observers_; 809 observer_map = async_observers_;
790 } 810 }
791 // Notify observers outside the lock in case they trigger trace events. 811 // Notify observers outside the lock in case they trigger trace events.
792 for (EnabledStateObserver* observer : observer_list) 812 for (EnabledStateObserver* observer : observer_list)
793 observer->OnTraceLogEnabled(); 813 observer->OnTraceLogEnabled();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 return kInternalNone; 850 return kInternalNone;
831 } 851 }
832 852
833 TraceConfig TraceLog::GetCurrentTraceConfig() const { 853 TraceConfig TraceLog::GetCurrentTraceConfig() const {
834 AutoLock lock(lock_); 854 AutoLock lock(lock_);
835 return trace_config_; 855 return trace_config_;
836 } 856 }
837 857
838 void TraceLog::SetDisabled() { 858 void TraceLog::SetDisabled() {
839 AutoLock lock(lock_); 859 AutoLock lock(lock_);
840 SetDisabledWhileLocked(); 860 SetDisabledWhileLocked(RECORDING_MODE);
841 } 861 }
842 862
843 void TraceLog::SetDisabledWhileLocked() { 863 void TraceLog::SetDisabled(uint8_t modes) {
864 AutoLock lock(lock_);
865 SetDisabledWhileLocked(modes);
866 }
867
868 void TraceLog::SetDisabledWhileLocked(uint8_t modes) {
844 lock_.AssertAcquired(); 869 lock_.AssertAcquired();
845 870
846 if (!IsEnabled()) 871 if (!(enabled_modes_ & modes))
847 return; 872 return;
848 873
849 if (dispatching_to_observer_list_) { 874 if (dispatching_to_observer_list_) {
850 DLOG(ERROR) 875 NOTREACHED()
851 << "Cannot manipulate TraceLog::Enabled state from an observer."; 876 << "Cannot manipulate TraceLog::Enabled state from an observer.";
852 return; 877 return;
853 } 878 }
854 879
855 mode_ = DISABLED; 880 enabled_modes_ &= ~modes;
856 881
857 trace_config_.Clear(); 882 if (modes & FILTERING_MODE)
858 subtle::NoBarrier_Store(&watch_category_, 0); 883 event_filters_enabled_.clear();
859 watch_event_name_.clear(); 884
885 if (modes & RECORDING_MODE) {
886 trace_config_.Clear();
887
888 subtle::NoBarrier_Store(&watch_category_, 0);
889 watch_event_name_.clear();
890 }
891
860 UpdateCategoryGroupEnabledFlags(); 892 UpdateCategoryGroupEnabledFlags();
893
894 // Skip adding metadata events and notifying observers for filtering mode.
895 if (!(modes & RECORDING_MODE))
896 return;
897
861 AddMetadataEventsWhileLocked(); 898 AddMetadataEventsWhileLocked();
862 899
863 // Remove metadata events so they will not get added to a subsequent trace. 900 // Remove metadata events so they will not get added to a subsequent trace.
864 metadata_events_.clear(); 901 metadata_events_.clear();
865 902
866 dispatching_to_observer_list_ = true; 903 dispatching_to_observer_list_ = true;
867 std::vector<EnabledStateObserver*> observer_list = 904 std::vector<EnabledStateObserver*> observer_list =
868 enabled_state_observer_list_; 905 enabled_state_observer_list_;
869 std::map<AsyncEnabledStateObserver*, RegisteredAsyncObserver> observer_map = 906 std::map<AsyncEnabledStateObserver*, RegisteredAsyncObserver> observer_map =
870 async_observers_; 907 async_observers_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 } 987 }
951 return trace_event; 988 return trace_event;
952 } 989 }
953 990
954 void TraceLog::CheckIfBufferIsFullWhileLocked() { 991 void TraceLog::CheckIfBufferIsFullWhileLocked() {
955 lock_.AssertAcquired(); 992 lock_.AssertAcquired();
956 if (logged_events_->IsFull()) { 993 if (logged_events_->IsFull()) {
957 if (buffer_limit_reached_timestamp_.is_null()) { 994 if (buffer_limit_reached_timestamp_.is_null()) {
958 buffer_limit_reached_timestamp_ = OffsetNow(); 995 buffer_limit_reached_timestamp_ = OffsetNow();
959 } 996 }
960 SetDisabledWhileLocked(); 997 SetDisabledWhileLocked(RECORDING_MODE);
961 } 998 }
962 } 999 }
963 1000
964 void TraceLog::SetEventCallbackEnabled(const TraceConfig& trace_config, 1001 void TraceLog::SetEventCallbackEnabled(const TraceConfig& trace_config,
965 EventCallback cb) { 1002 EventCallback cb) {
966 AutoLock lock(lock_); 1003 AutoLock lock(lock_);
967 subtle::NoBarrier_Store(&event_callback_, 1004 subtle::NoBarrier_Store(&event_callback_,
968 reinterpret_cast<subtle::AtomicWord>(cb)); 1005 reinterpret_cast<subtle::AtomicWord>(cb));
969 event_callback_trace_config_ = trace_config; 1006 event_callback_trace_config_ = trace_config;
970 UpdateCategoryGroupEnabledFlags(); 1007 UpdateCategoryGroupEnabledFlags();
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) { 1374 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) {
1338 if ((flags & TRACE_EVENT_FLAG_FLOW_IN) || 1375 if ((flags & TRACE_EVENT_FLAG_FLOW_IN) ||
1339 (flags & TRACE_EVENT_FLAG_FLOW_OUT)) 1376 (flags & TRACE_EVENT_FLAG_FLOW_OUT))
1340 bind_id = MangleEventId(bind_id); 1377 bind_id = MangleEventId(bind_id);
1341 id = MangleEventId(id); 1378 id = MangleEventId(id);
1342 } 1379 }
1343 1380
1344 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp); 1381 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp);
1345 ThreadTicks thread_now = ThreadNow(); 1382 ThreadTicks thread_now = ThreadNow();
1346 1383
1347 // |thread_local_event_buffer_| can be null if the current thread doesn't have
1348 // a message loop or the message loop is blocked.
1349 InitializeThreadLocalEventBufferIfSupported();
Primiano Tucci (use gerrit) 2016/10/12 17:50:17 hmm can you keep the InitializeTLEBIS here (maybe
ssid 2016/10/12 19:04:44 Done.
1350 auto* thread_local_event_buffer = thread_local_event_buffer_.Get();
1351
1352 // Check and update the current thread name only if the event is for the 1384 // Check and update the current thread name only if the event is for the
1353 // current thread to avoid locks in most cases. 1385 // current thread to avoid locks in most cases.
1354 if (thread_id == static_cast<int>(PlatformThread::CurrentId())) { 1386 if (thread_id == static_cast<int>(PlatformThread::CurrentId())) {
1355 const char* new_name = 1387 const char* new_name =
1356 ThreadIdNameManager::GetInstance()->GetName(thread_id); 1388 ThreadIdNameManager::GetInstance()->GetName(thread_id);
1357 // Check if the thread name has been set or changed since the previous 1389 // Check if the thread name has been set or changed since the previous
1358 // call (if any), but don't bother if the new name is empty. Note this will 1390 // call (if any), but don't bother if the new name is empty. Note this will
1359 // not detect a thread name change within the same char* buffer address: we 1391 // not detect a thread name change within the same char* buffer address: we
1360 // favor common case performance over corner case correctness. 1392 // favor common case performance over corner case correctness.
1361 if (new_name != g_current_thread_name.Get().Get() && new_name && 1393 if (new_name != g_current_thread_name.Get().Get() && new_name &&
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 disabled_by_filters = false; 1445 disabled_by_filters = false;
1414 }); 1446 });
1415 if (!disabled_by_filters) 1447 if (!disabled_by_filters)
1416 filtered_trace_event = std::move(new_trace_event); 1448 filtered_trace_event = std::move(new_trace_event);
1417 } 1449 }
1418 1450
1419 // If enabled for recording, the event should be added only if one of the 1451 // If enabled for recording, the event should be added only if one of the
1420 // filters indicates or category is not enabled for filtering. 1452 // filters indicates or category is not enabled for filtering.
1421 if ((*category_group_enabled & ENABLED_FOR_RECORDING) && 1453 if ((*category_group_enabled & ENABLED_FOR_RECORDING) &&
1422 !disabled_by_filters) { 1454 !disabled_by_filters) {
1455 // |thread_local_event_buffer_| can be null if the current thread doesn't
1456 // have a message loop or the message loop is blocked.
1457 InitializeThreadLocalEventBufferIfSupported();
1458 auto* thread_local_event_buffer = thread_local_event_buffer_.Get();
1459
1423 OptionalAutoLock lock(&lock_); 1460 OptionalAutoLock lock(&lock_);
1424 1461
1425 TraceEvent* trace_event = NULL; 1462 TraceEvent* trace_event = NULL;
1426 if (thread_local_event_buffer) { 1463 if (thread_local_event_buffer) {
1427 trace_event = thread_local_event_buffer->AddTraceEvent(&handle); 1464 trace_event = thread_local_event_buffer->AddTraceEvent(&handle);
1428 } else { 1465 } else {
1429 lock.EnsureAcquired(); 1466 lock.EnsureAcquired();
1430 trace_event = AddEventToThreadSharedChunkWhileLocked(&handle, true); 1467 trace_event = AddEventToThreadSharedChunkWhileLocked(&handle, true);
1431 } 1468 }
1432 1469
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 } 1962 }
1926 1963
1927 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 1964 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
1928 if (*category_group_enabled_) { 1965 if (*category_group_enabled_) {
1929 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, 1966 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_,
1930 event_handle_); 1967 event_handle_);
1931 } 1968 }
1932 } 1969 }
1933 1970
1934 } // namespace trace_event_internal 1971 } // namespace trace_event_internal
OLDNEW
« base/trace_event/trace_log.h ('K') | « base/trace_event/trace_log.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698