diff --git a/cc/metrics/throughput_ukm_reporter.cc b/cc/metrics/throughput_ukm_reporter.cc index 796cd184b32226..8a899af98bccfd 100644 --- a/cc/metrics/throughput_ukm_reporter.cc +++ b/cc/metrics/throughput_ukm_reporter.cc @@ -10,7 +10,7 @@ namespace cc { namespace { // Collect UKM once per kNumberOfSamplesToReport UMA reports. -constexpr unsigned kNumberOfSamplesToReport = 2000u; +constexpr unsigned kNumberOfSamplesToReport = 100u; } // namespace void ThroughputUkmReporter::ReportThroughputUkm( @@ -19,17 +19,12 @@ void ThroughputUkmReporter::ReportThroughputUkm( const base::Optional& impl_throughput_percent, const base::Optional& main_throughput_percent, FrameSequenceTrackerType type) { - // Sampling control. We sample the event here to not throttle the UKM system. - // Currently, the same sampling rate is applied to all existing trackers. We - // might want to iterate on this based on the collected data. - static uint32_t samples_to_next_event = 0; - - if (samples_to_next_event == 0) { + if (samples_to_next_event_ == 0) { // Sample every 2000 events. Using the Universal tracker as an example // which reports UMA every 5s, then the system collects UKM once per // 2000*5 = 10000 seconds, which is about 3 hours. This number may need to // be tuned to not throttle the UKM system. - samples_to_next_event = kNumberOfSamplesToReport; + samples_to_next_event_ = kNumberOfSamplesToReport; if (impl_throughput_percent) { ukm_manager->RecordThroughputUKM( type, FrameSequenceTracker::ThreadType::kCompositor, @@ -44,8 +39,8 @@ void ThroughputUkmReporter::ReportThroughputUkm( FrameSequenceTracker::ThreadType::kSlower, slower_throughput_percent.value()); } - DCHECK_GT(samples_to_next_event, 0u); - samples_to_next_event--; + DCHECK_GT(samples_to_next_event_, 0u); + samples_to_next_event_--; } } // namespace cc diff --git a/cc/metrics/throughput_ukm_reporter.h b/cc/metrics/throughput_ukm_reporter.h index defa8703ee876e..9d459c5fb0459a 100644 --- a/cc/metrics/throughput_ukm_reporter.h +++ b/cc/metrics/throughput_ukm_reporter.h @@ -24,6 +24,12 @@ class CC_EXPORT ThroughputUkmReporter { const base::Optional& impl_throughput_percent, const base::Optional& main_throughput_percent, FrameSequenceTrackerType type); + + private: + // Sampling control. We sample the event here to not throttle the UKM system. + // Currently, the same sampling rate is applied to all existing trackers. We + // might want to iterate on this based on the collected data. + uint32_t samples_to_next_event_ = 0; }; } // namespace cc