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 @@
namespace blink {
ScrollPredictor::ScrollPredictor()
: metrics_handler_("Event.InputEventPrediction.Scroll") {
ScrollPredictor::ScrollPredictor() {
// Get the predictor from feature flags
std::string predictor_name = GetFieldTrialParamValueByFeature(
blink::features::kResamplingScrollEvents, "predictor");
......
......@@ -2,18 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <utility>
#include "ui/base/prediction/prediction_metrics_handler.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
namespace ui {
PredictionMetricsHandler::PredictionMetricsHandler(const char* histogram_name)
: histogram_name_(std::move(histogram_name)) {}
PredictionMetricsHandler::~PredictionMetricsHandler() = default;
PredictionMetricsHandler::PredictionMetricsHandler() {}
PredictionMetricsHandler::~PredictionMetricsHandler() {}
void PredictionMetricsHandler::AddRealEvent(const gfx::PointF& pos,
const base::TimeTicks& time_stamp,
......@@ -134,25 +130,25 @@ void PredictionMetricsHandler::ComputeMetrics() {
for (int i = 0; i < first_needed_event - 1; i++)
events_queue_.pop_front();
std::string kPredictionMetrics = "Event.InputEventPrediction.Scroll.";
double score = ComputeOverUnderPredictionMetric();
if (score >= 0) {
base::UmaHistogramCounts1000(
base::StrCat({histogram_name_, ".OverPrediction"}), score);
base::UmaHistogramCounts1000(kPredictionMetrics + "OverPrediction", score);
} else {
base::UmaHistogramCounts1000(
base::StrCat({histogram_name_, ".UnderPrediction"}), -score);
base::UmaHistogramCounts1000(kPredictionMetrics + "UnderPrediction",
-score);
}
// Need |last_predicted_| to compute WrongDirection and Jitter metrics.
if (!last_predicted_.has_value())
return;
base::UmaHistogramBoolean(base::StrCat({histogram_name_, ".WrongDirection"}),
base::UmaHistogramBoolean(kPredictionMetrics + "WrongDirection",
ComputeWrongDirectionMetric());
base::UmaHistogramCounts1000(
base::StrCat({histogram_name_, ".PredictionJitter"}),
ComputePredictionJitterMetric());
base::UmaHistogramCounts1000(base::StrCat({histogram_name_, ".VisualJitter"}),
base::UmaHistogramCounts1000(kPredictionMetrics + "PredictionJitter",
ComputePredictionJitterMetric());
base::UmaHistogramCounts1000(kPredictionMetrics + "VisualJitter",
ComputeVisualJitterMetric());
}
......
......@@ -25,7 +25,7 @@ class PredictionMetricsHandlerTest;
// few metrics.
class COMPONENT_EXPORT(UI_BASE_PREDICTION) PredictionMetricsHandler {
public:
explicit PredictionMetricsHandler(const char* histogram_name);
explicit PredictionMetricsHandler();
~PredictionMetricsHandler();
// Struct used to store predicted and real event information.
......@@ -103,12 +103,6 @@ class COMPONENT_EXPORT(UI_BASE_PREDICTION) PredictionMetricsHandler {
base::Optional<gfx::PointF> last_predicted_ = base::nullopt;
// The first real event position which time is later than the predicted time.
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
......
......@@ -29,8 +29,7 @@ class PredictionMetricsHandlerTest : public testing::Test {
explicit PredictionMetricsHandlerTest() {}
void SetUp() override {
metrics_handler_ = std::make_unique<PredictionMetricsHandler>(
"Event.InputEventPrediction.Scroll");
metrics_handler_ = std::make_unique<PredictionMetricsHandler>();
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