Flutter Engine
 
Loading...
Searching...
No Matches
fml::TimePoint Class Reference

#include <time_point.h>

Public Types

using ClockSource = TimePoint(*)()
 

Public Member Functions

constexpr TimePoint ()=default
 
constexpr TimeDelta ToEpochDelta () const
 
constexpr TimeDelta operator- (TimePoint other) const
 
constexpr TimePoint operator+ (TimeDelta duration) const
 
constexpr TimePoint operator- (TimeDelta duration) const
 
constexpr auto operator<=> (const TimePoint &other) const =default
 

Static Public Member Functions

static void SetClockSource (ClockSource source)
 
static TimePoint Now ()
 
static TimePoint CurrentWallTime ()
 
static constexpr TimePoint Min ()
 
static constexpr TimePoint Max ()
 
static constexpr TimePoint FromEpochDelta (TimeDelta ticks)
 
static constexpr TimePoint FromTicks (int64_t ticks)
 

Detailed Description

Definition at line 22 of file time_point.h.

Member Typedef Documentation

◆ ClockSource

Definition at line 24 of file time_point.h.

Constructor & Destructor Documentation

◆ TimePoint()

constexpr fml::TimePoint::TimePoint ( )
constexprdefault

Member Function Documentation

◆ CurrentWallTime()

TimePoint fml::TimePoint::CurrentWallTime ( )
static

Definition at line 57 of file time_point.cc.

57 {
58 const int64_t nanos = NanosSinceEpoch(std::chrono::system_clock::now());
59 return TimePoint(nanos);
60}
constexpr TimePoint()=default
static int64_t NanosSinceEpoch(std::chrono::time_point< Clock, Duration > time_point)
Definition time_point.cc:39

References fml::NanosSinceEpoch(), and TimePoint().

Referenced by flutter::FrameTimingsRecorder::RecordRasterEnd(), flutter::TEST(), and flutter::TEST().

◆ FromEpochDelta()

static constexpr TimePoint fml::TimePoint::FromEpochDelta ( TimeDelta  ticks)
inlinestaticconstexpr

◆ FromTicks()

static constexpr TimePoint fml::TimePoint::FromTicks ( int64_t  ticks)
inlinestaticconstexpr

Definition at line 48 of file time_point.h.

48 {
49 return TimePoint(ticks);
50 }

References TimePoint().

Referenced by fml::ChronoTimestampProvider::Now(), and flutter::DartTimestampProvider::Now().

◆ Max()

static constexpr TimePoint fml::TimePoint::Max ( )
inlinestaticconstexpr

Definition at line 39 of file time_point.h.

39 {
40 return TimePoint(std::numeric_limits<int64_t>::max());
41 }

References TimePoint().

Referenced by fml::MessageLoopTaskQueues::GetNextTaskToRun(), fml::testing::TEST(), fml::testing::TEST(), fml::testing::TEST(), and fml::testing::TEST().

◆ Min()

static constexpr TimePoint fml::TimePoint::Min ( )
inlinestaticconstexpr

Definition at line 35 of file time_point.h.

35 {
36 return TimePoint(std::numeric_limits<int64_t>::min());
37 }

References TimePoint().

◆ Now()

TimePoint fml::TimePoint::Now ( )
static

Definition at line 49 of file time_point.cc.

49 {
50 if (gSteadyClockSource) {
51 return gSteadyClockSource.load()();
52 }
53 const int64_t nanos = NanosSinceEpoch(std::chrono::steady_clock::now());
54 return TimePoint(nanos);
55}

References fml::NanosSinceEpoch(), and TimePoint().

Referenced by flutter::testing::ShellTestVsyncWaiter::AwaitVSync(), flutter_runner::FlatlandConnection::AwaitVsync(), flutter_runner::FlatlandConnection::AwaitVsyncForSecondaryCallback(), fml::benchmarking::BM_RegisterAndGetTasks(), flutter::testing::PendingTests::CheckTimedOutTests(), flutter::CreateFinishedBuildRecorder(), flutter::PersistentCache::DumpSkp(), flutter::VsyncWaiter::FireCallback(), FlutterEngineGetCurrentTime(), impeller::Playground::GetSecondsElapsed(), flutter::Shell::GetVsyncWaiter(), flutter_runner::testing::FlatlandConnectionTest::OnNextFrameBegin(), fml::TaskRunner::PostDelayedTask(), fml::TaskRunner::PostTask(), flutter::testing::ShellTest::PumpOneFrame(), flutter::FrameTimingsRecorder::RecordRasterEnd(), flutter::Animator::Render(), impeller::ComputePlaygroundTest::SetUp(), impeller::Playground::SetupWindow(), flutter::Stopwatch::Start(), flutter::Stopwatch::Stop(), flutter::testing::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), fml::testing::TEST(), fml::testing::TEST(), fml::testing::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), flutter::TEST(), TEST(), flutter_runner::TEST(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), fml::AutoResetWaitableEvent::WaitWithTimeout(), and fml::WaitWithTimeoutImpl().

◆ operator+()

constexpr TimePoint fml::TimePoint::operator+ ( TimeDelta  duration) const
inlineconstexpr

Definition at line 61 of file time_point.h.

61 {
62 return TimePoint(ticks_ + duration.ToNanoseconds());
63 }

References TimePoint(), and fml::TimeDelta::ToNanoseconds().

◆ operator-() [1/2]

constexpr TimePoint fml::TimePoint::operator- ( TimeDelta  duration) const
inlineconstexpr

Definition at line 64 of file time_point.h.

64 {
65 return TimePoint(ticks_ - duration.ToNanoseconds());
66 }

References TimePoint(), and fml::TimeDelta::ToNanoseconds().

◆ operator-() [2/2]

constexpr TimeDelta fml::TimePoint::operator- ( TimePoint  other) const
inlineconstexpr

Definition at line 57 of file time_point.h.

57 {
58 return TimeDelta::FromNanoseconds(ticks_ - other.ticks_);
59 }
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
Definition time_delta.h:40

References fml::TimeDelta::FromNanoseconds().

◆ operator<=>()

constexpr auto fml::TimePoint::operator<=> ( const TimePoint other) const
constexprdefault

◆ SetClockSource()

void fml::TimePoint::SetClockSource ( ClockSource  source)
static

Definition at line 45 of file time_point.cc.

45 {
46 gSteadyClockSource = source;
47}

Referenced by DartVMInitializer::Initialize().

◆ ToEpochDelta()


The documentation for this class was generated from the following files: