Commit 0a5eebbf authored by Kristi Park's avatar Kristi Park Committed by Commit Bot

Revert "De-couple PredictionMetricsHandler from specific histograms"

This reverts commit 1d11f9fd.

Reason for revert: Suspect for failing test, InputHandlerProxyEventQueueTest.VSyncAlignedGestureScrollPinchScroll
https://ci.chromium.org/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests/20826

Original change's description:
> De-couple PredictionMetricsHandler from specific histograms
>
> PredictionMetricsHandler appears to be designed to work for anything
> that is predicting points. However, it currently only reports metrics
> in the Event.InputEventPrediction.Scroll* histograms. De-couple the
> class from these histograms so it can be used for things only than
> scroll metrics.
>
> Bug: 1133785
> Change-Id: Ib34129fc46b20b45810cbd5ca195483e88c513e2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2441197
> Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
> Commit-Queue: Mario Bianucci <mabian@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#813813}

TBR=sadrul@chromium.org,dtapuska@chromium.org,mabian@microsoft.com

Change-Id: I9cefcdb1b51f13026726eb2449e1213f43dfc91f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1133785
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451569Reviewed-by: default avatarKristi Park <kristipark@chromium.org>
Commit-Queue: Kristi Park <kristipark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813996}
parent 29f827a6
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
namespace blink { namespace blink {
ScrollPredictor::ScrollPredictor() ScrollPredictor::ScrollPredictor() {
: metrics_handler_("Event.InputEventPrediction.Scroll") {
// Get the predictor from feature flags // Get the predictor from feature flags
std::string predictor_name = GetFieldTrialParamValueByFeature( std::string predictor_name = GetFieldTrialParamValueByFeature(
blink::features::kResamplingScrollEvents, "predictor"); blink::features::kResamplingScrollEvents, "predictor");
......
...@@ -2,18 +2,14 @@ ...@@ -2,18 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include <utility>
#include "ui/base/prediction/prediction_metrics_handler.h" #include "ui/base/prediction/prediction_metrics_handler.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
namespace ui { namespace ui {
PredictionMetricsHandler::PredictionMetricsHandler(const char* histogram_name) PredictionMetricsHandler::PredictionMetricsHandler() {}
: histogram_name_(std::move(histogram_name)) {} PredictionMetricsHandler::~PredictionMetricsHandler() {}
PredictionMetricsHandler::~PredictionMetricsHandler() = default;
void PredictionMetricsHandler::AddRealEvent(const gfx::PointF& pos, void PredictionMetricsHandler::AddRealEvent(const gfx::PointF& pos,
const base::TimeTicks& time_stamp, const base::TimeTicks& time_stamp,
...@@ -134,25 +130,25 @@ void PredictionMetricsHandler::ComputeMetrics() { ...@@ -134,25 +130,25 @@ void PredictionMetricsHandler::ComputeMetrics() {
for (int i = 0; i < first_needed_event - 1; i++) for (int i = 0; i < first_needed_event - 1; i++)
events_queue_.pop_front(); events_queue_.pop_front();
std::string kPredictionMetrics = "Event.InputEventPrediction.Scroll.";
double score = ComputeOverUnderPredictionMetric(); double score = ComputeOverUnderPredictionMetric();
if (score >= 0) { if (score >= 0) {
base::UmaHistogramCounts1000( base::UmaHistogramCounts1000(kPredictionMetrics + "OverPrediction", score);
base::StrCat({histogram_name_, ".OverPrediction"}), score);
} else { } else {
base::UmaHistogramCounts1000( base::UmaHistogramCounts1000(kPredictionMetrics + "UnderPrediction",
base::StrCat({histogram_name_, ".UnderPrediction"}), -score); -score);
} }
// Need |last_predicted_| to compute WrongDirection and Jitter metrics. // Need |last_predicted_| to compute WrongDirection and Jitter metrics.
if (!last_predicted_.has_value()) if (!last_predicted_.has_value())
return; return;
base::UmaHistogramBoolean(base::StrCat({histogram_name_, ".WrongDirection"}), base::UmaHistogramBoolean(kPredictionMetrics + "WrongDirection",
ComputeWrongDirectionMetric()); ComputeWrongDirectionMetric());
base::UmaHistogramCounts1000( base::UmaHistogramCounts1000(kPredictionMetrics + "PredictionJitter",
base::StrCat({histogram_name_, ".PredictionJitter"}), ComputePredictionJitterMetric());
ComputePredictionJitterMetric()); base::UmaHistogramCounts1000(kPredictionMetrics + "VisualJitter",
base::UmaHistogramCounts1000(base::StrCat({histogram_name_, ".VisualJitter"}),
ComputeVisualJitterMetric()); ComputeVisualJitterMetric());
} }
......
...@@ -25,7 +25,7 @@ class PredictionMetricsHandlerTest; ...@@ -25,7 +25,7 @@ class PredictionMetricsHandlerTest;
// few metrics. // few metrics.
class COMPONENT_EXPORT(UI_BASE_PREDICTION) PredictionMetricsHandler { class COMPONENT_EXPORT(UI_BASE_PREDICTION) PredictionMetricsHandler {
public: public:
explicit PredictionMetricsHandler(const char* histogram_name); explicit PredictionMetricsHandler();
~PredictionMetricsHandler(); ~PredictionMetricsHandler();
// Struct used to store predicted and real event information. // Struct used to store predicted and real event information.
...@@ -103,12 +103,6 @@ class COMPONENT_EXPORT(UI_BASE_PREDICTION) PredictionMetricsHandler { ...@@ -103,12 +103,6 @@ class COMPONENT_EXPORT(UI_BASE_PREDICTION) PredictionMetricsHandler {
base::Optional<gfx::PointF> last_predicted_ = base::nullopt; base::Optional<gfx::PointF> last_predicted_ = base::nullopt;
// The first real event position which time is later than the predicted time. // The first real event position which time is later than the predicted time.
gfx::PointF next_real_; gfx::PointF next_real_;
// Beginning of the full histogram name. It will have the various metrics'
// names (.OverPrediction, .UnderPrediction, .WrongDirection,
// .PredictionJitter, .VisualJitter) appended to it when counting the metric
// in a histogram.
const char* const histogram_name_;
}; };
} // namespace ui } // namespace ui
......
...@@ -29,8 +29,7 @@ class PredictionMetricsHandlerTest : public testing::Test { ...@@ -29,8 +29,7 @@ class PredictionMetricsHandlerTest : public testing::Test {
explicit PredictionMetricsHandlerTest() {} explicit PredictionMetricsHandlerTest() {}
void SetUp() override { void SetUp() override {
metrics_handler_ = std::make_unique<PredictionMetricsHandler>( metrics_handler_ = std::make_unique<PredictionMetricsHandler>();
"Event.InputEventPrediction.Scroll");
histogram_tester_ = std::make_unique<base::HistogramTester>(); histogram_tester_ = std::make_unique<base::HistogramTester>();
} }
......
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