#include "cc/metrics/predictor_jank_tracker.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <utility>
#include "base/metrics/histogram_macros.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "base/tracing/protos/chrome_track_event.pbzero.h"
namespace cc {
namespace {
constexpr float kScrollDeltaThreshold = …;
constexpr float kSlowJankyThreshold = …;
constexpr float kFastJankyThreshold = …;
float GetMaxDelta(float d1, float d2, float d3) { … }
std::pair<float, bool> GetJankyThresholdAndScrollSpeed(float d1,
float d2,
float d3) { … }
bool VerifyFramesSameDirection(float& d1, float& d2, float& d3) { … }
}
PredictorJankTracker::PredictorJankTracker() = default;
PredictorJankTracker::~PredictorJankTracker() = default;
float PredictorJankTracker::GetSlowScrollDeltaThreshold() { … }
float PredictorJankTracker::GetSlowScrollJankyThreshold() { … }
float PredictorJankTracker::GetFastScrollJankyThreshold() { … }
void PredictorJankTracker::ReportLatestScrollDelta(
float next_delta,
base::TimeTicks next_presentation_ts,
base::TimeDelta vsync_interval,
std::optional<EventMetrics::TraceId> trace_id) { … }
void PredictorJankTracker::ReportJankyFrame(
float next_delta,
float janky_value,
bool contains_missed_vsyncs,
bool slow_scroll,
std::optional<EventMetrics::TraceId> trace_id) { … }
bool PredictorJankTracker::ContainsMissedVSync(
base::TimeTicks& next_presentation_ts,
base::TimeDelta& vsync_interval) { … }
void PredictorJankTracker::StoreLatestFrameData(
float delta,
base::TimeTicks presentation_ts,
std::optional<EventMetrics::TraceId> trace_id) { … }
void PredictorJankTracker::ResetCurrentScrollReporting() { … }
void PredictorJankTracker::ReportJankyFramePercentage() { … }
}