5#include "flutter/flow/stopwatch.h"
12 : refresh_rate_updater_(updater), start_(
fml::
TimePoint::Now()) {
21 :
Stopwatch(fixed_delegate_), fixed_delegate_(frame_budget) {}
25 : fixed_frame_budget_(fixed_frame_budget) {}
29 current_sample_ = (current_sample_ + 1) %
kMaxSamples;
37 current_sample_ = (current_sample_ + 1) %
kMaxSamples;
38 laps_[current_sample_] =
delta;
54 return current_sample_;
62 double max_unit_interval)
const {
64 if (unit_height > 1.0) {
73 if (laps_[
i] > max_delta) {
93 return fixed_frame_budget_;
FixedRefreshRateStopwatch(fml::Milliseconds fixed_frame_budget=fml::kDefaultFrameBudget)
FixedRefreshRateUpdater(fml::Milliseconds fixed_frame_budget=fml::kDefaultFrameBudget)
double UnitHeight(double time_ms, double max_height) const
Converts a raster time to a unit height.
fml::Milliseconds frame_budget_
double UnitFrameInterval(double time_ms) const
Converts a raster time to a unit interval.
The refresh rate interface for Stopwatch.
virtual fml::Milliseconds GetFrameBudget() const =0
const fml::TimeDelta & GetLap(size_t index) const
const fml::TimeDelta & LastLap() const
fml::Milliseconds GetFrameBudget() const
All places which want to get frame_budget should call this function.
fml::TimeDelta MaxDelta() const
size_t GetLapsCount() const
Return a reference to all the laps.
size_t GetCurrentSample() const
void SetLapTime(const fml::TimeDelta &delta)
Stopwatch(const RefreshRateUpdater &updater)
fml::TimeDelta AverageDelta() const
static constexpr TimeDelta Zero()
static const size_t kMaxSamples
std::chrono::duration< double, std::milli > Milliseconds
std::chrono::time_point< std::chrono::high_resolution_clock > TimePoint