#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "cc/metrics/dropped_frame_counter.h"
#include <algorithm>
#include <cmath>
#include <iterator>
#include "base/functional/bind.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "build/chromeos_buildflags.h"
#include "cc/metrics/custom_metrics_recorder.h"
#include "cc/metrics/frame_sorter.h"
#include "cc/metrics/total_frame_counter.h"
#include "cc/metrics/ukm_smoothness_data.h"
namespace cc {
namespace {
const base::TimeDelta kDefaultSlidingWindowInterval = …;
constexpr double kBucketBounds[7] = …;
size_t DecideSmoothnessBucket(double pdf) { … }
}
SlidingWindowHistogram;
void SlidingWindowHistogram::AddPercentDroppedFrame(
double percent_dropped_frame,
size_t count) { … }
uint32_t SlidingWindowHistogram::GetPercentDroppedFramePercentile(
double percentile) const { … }
double SlidingWindowHistogram::GetPercentDroppedFrameVariance() const { … }
std::vector<double> SlidingWindowHistogram::GetPercentDroppedFrameBuckets()
const { … }
void SlidingWindowHistogram::Clear() { … }
std::ostream& SlidingWindowHistogram::Dump(std::ostream& stream) const { … }
std::ostream& operator<<(
std::ostream& stream,
const DroppedFrameCounter::SlidingWindowHistogram& histogram) { … }
DroppedFrameCounter::DroppedFrameCounter()
: … { … }
DroppedFrameCounter::~DroppedFrameCounter() = default;
uint32_t DroppedFrameCounter::GetAverageThroughput() const { … }
void DroppedFrameCounter::AddGoodFrame() { … }
void DroppedFrameCounter::AddPartialFrame() { … }
void DroppedFrameCounter::AddDroppedFrame() { … }
void DroppedFrameCounter::ResetPendingFrames(base::TimeTicks timestamp) { … }
void DroppedFrameCounter::EnableReporForUI() { … }
void DroppedFrameCounter::OnBeginFrame(const viz::BeginFrameArgs& args) { … }
void DroppedFrameCounter::OnEndFrame(const viz::BeginFrameArgs& args,
const FrameInfo& frame_info) { … }
void DroppedFrameCounter::ReportFrames() { … }
void DroppedFrameCounter::ReportFramesOnEveryFrameForUI() { … }
double DroppedFrameCounter::GetMostRecentAverageSmoothness() const { … }
double DroppedFrameCounter::GetMostRecent95PercentileSmoothness() const { … }
void DroppedFrameCounter::SetUkmSmoothnessDestination(
UkmSmoothnessDataShared* smoothness_data) { … }
void DroppedFrameCounter::Reset() { … }
base::TimeDelta DroppedFrameCounter::ComputeCurrentWindowSize() const { … }
void DroppedFrameCounter::NotifyFrameResult(const viz::BeginFrameArgs& args,
const FrameInfo& frame_info) { … }
void DroppedFrameCounter::PopSlidingWindow() { … }
void DroppedFrameCounter::UpdateDroppedFrameCountInWindow(
const FrameInfo& frame_info,
int count) { … }
void DroppedFrameCounter::UpdateMaxPercentDroppedFrame(
double percent_dropped_frame) { … }
void DroppedFrameCounter::OnFcpReceived() { … }
void DroppedFrameCounter::SetSortedFrameCallback(SortedFrameCallback callback) { … }
}