Commit f509a32b authored by Navid Zolghadr's avatar Navid Zolghadr Committed by Commit Bot

Remove input metric ukm sampling

We added a sampling scheme when ukm was introduced
back in the day to control the amount of data we
report to the server.
Now that there is a general mechanism for controling
the data we can remove our own version of resampling
and rely only on the dashboard team to take care of
that.

Bug: 895463
Change-Id: If23332437205aa027b77a1140f28b9492692791a
Reviewed-on: https://chromium-review.googlesource.com/c/1283941Reviewed-by: default avatarSahel Sharify <sahel@chromium.org>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Reviewed-by: default avatarBryan McQuade <bmcquade@chromium.org>
Commit-Queue: Navid Zolghadr <nzolghadr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601247}
parent 867100ad
......@@ -137,7 +137,6 @@ class RenderWidgetHostLatencyTrackerTest
RenderViewHostImplTestHarness::SetUp();
old_browser_client_ = SetBrowserClientForTesting(&test_browser_client_);
tracker_ = std::make_unique<RenderWidgetHostLatencyTracker>(contents());
viz_tracker_.DisableMetricSamplingForTesting();
}
void TearDown() override {
......
......@@ -106,10 +106,6 @@ void LatencyTracker::OnGpuSwapBuffersCompleted(const LatencyInfo& latency) {
}
}
void LatencyTracker::DisableMetricSamplingForTesting() {
metric_sampling_ = false;
}
void LatencyTracker::ReportUkmScrollLatency(
const InputMetricEvent& metric_event,
base::TimeTicks start_timestamp,
......@@ -121,11 +117,6 @@ void LatencyTracker::ReportUkmScrollLatency(
time_to_scroll_update_swap_begin_timestamp)
CONFIRM_EVENT_TIMES_EXIST(start_timestamp, time_to_handled_timestamp)
// Only report a subset of this metric as the volume is too high.
if (metric_sampling_ &&
!sampling_scheme_[static_cast<int>(metric_event)].ShouldReport())
return;
ukm::UkmRecorder* ukm_recorder = ukm::UkmRecorder::Get();
if (ukm_source_id == ukm::kInvalidSourceId || !ukm_recorder)
return;
......
......@@ -23,9 +23,6 @@ class LatencyTracker {
void OnGpuSwapBuffersCompleted(const std::vector<LatencyInfo>& latency_info);
void OnGpuSwapBuffersCompleted(const LatencyInfo& latency);
// Disables sampling of high volume metrics in unit tests.
void DisableMetricSamplingForTesting();
using LatencyInfoProcessor =
base::RepeatingCallback<void(const std::vector<ui::LatencyInfo>&)>;
static void SetLatencyInfoProcessorForTesting(
......@@ -54,39 +51,6 @@ class LatencyTracker {
base::TimeTicks gpu_swap_end_timestamp,
const LatencyInfo& latency);
typedef struct SamplingScheme {
SamplingScheme() : interval_(1), last_sample_(0) {}
SamplingScheme(int interval)
: interval_(interval), last_sample_(rand() % interval) {}
bool ShouldReport() {
last_sample_++;
last_sample_ %= interval_;
return last_sample_ == 0;
}
private:
int interval_;
int last_sample_;
} SamplingScheme;
// Whether the sampling is needed for high volume metrics. This will be off
// when we are in unit tests. This is a temporary field so we can come up with
// a more permanent solution for crbug.com/739169.
bool metric_sampling_ = true;
// The i'th member of this array stores the sampling rate for the i'th
// input metric event type. Initializing SamplingScheme with number X means
// that from every X events one will be reported. Note that the first event
// to report is also randomized.
SamplingScheme sampling_scheme_
[static_cast<int>(InputMetricEvent::INPUT_METRIC_EVENT_MAX) + 1] = {
SamplingScheme(5), // SCROLL_BEGIN_TOUCH
SamplingScheme(50), // SCROLL_UPDATE_TOUCH
SamplingScheme(5), // SCROLL_BEGIN_WHEEL
SamplingScheme(2), // SCROLL_UPDATE_WHEEL
};
DISALLOW_COPY_AND_ASSIGN(LatencyTracker);
};
} // namespace latency
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment