Flutter Engine
fml::TimePoint Class Reference

#include <time_point.h>

Public Types

using ClockSource = TimePoint(*)()
 

Public Member Functions

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

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 ( )
default

Member Function Documentation

◆ CurrentWallTime()

TimePoint fml::TimePoint::CurrentWallTime ( )
static

Definition at line 57 of file time_point.cc.

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

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

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

◆ FromEpochDelta()

◆ FromTicks()

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

Definition at line 48 of file time_point.h.

References TimePoint().

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

48  {
49  return TimePoint(ticks);
50  }
constexpr TimePoint()=default

◆ Max()

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

Definition at line 39 of file time_point.h.

References TimePoint().

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

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

◆ Min()

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

Definition at line 35 of file time_point.h.

References TimePoint().

Referenced by flutter_runner::GfxSessionConnection::AwaitVsyncForSecondaryCallback().

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

◆ Now()

TimePoint fml::TimePoint::Now ( )
static

Definition at line 49 of file time_point.cc.

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

Referenced by VSyncClient::await, flutter::testing::ShellTestVsyncWaiter::AwaitVSync(), flutter_runner::FlatlandConnection::AwaitVsync(), flutter_runner::FlatlandConnection::AwaitVsyncForSecondaryCallback(), fml::benchmarking::BM_RegisterAndGetTasks(), flutter::testing::PendingTests::CheckTimedOutTests(), flutter::CreateFinishedBuildRecorder(), fml::MessageLoopImpl::DoTerminate(), flutter::Rasterizer::Draw(), flutter::PersistentCache::DumpSkp(), flutter::VsyncWaiter::FireCallback(), FlutterEngineGetCurrentTime(), flutter::FxlToDartOrEarlier(), flutter::EmbedderTaskRunner::GetEmbedderIdentifier(), flutter::testing::GetTestNameFromTestInfo(), flutter::Animator::GetVsyncWaiter(), flutter::DartIsolate::LoadLoadingUnitError(), flutter::Shell::OnDisplayUpdates(), flutter::DisplayListLayer::Paint(), fml::TaskRunner::PostDelayedTask(), fml::TaskRunner::PostTask(), flutter::FrameTimingsRecorder::RecordRasterEnd(), flutter::Animator::Render(), flutter::SerializeLayerSnapshot(), flutter::Stopwatch::Start(), flutter::Stopwatch::Stop(), TEST(), flutter_runner::TEST(), flutter::testing::TEST(), fml::testing::TEST(), flutter::TEST(), flutter_runner::testing::TEST(), flutter_runner::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), flutter::VsyncWaiterAndroid::VsyncWaiterAndroid(), flutter::VsyncWaiterFallback::VsyncWaiterFallback(), fml::AutoResetWaitableEvent::WaitWithTimeout(), and fml::WaitWithTimeoutImpl().

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 }
constexpr TimePoint()=default
static int64_t NanosSinceEpoch(std::chrono::time_point< Clock, Duration > time_point)
Definition: time_point.cc:39

◆ operator!=()

bool fml::TimePoint::operator!= ( TimePoint  other) const
inline

Definition at line 67 of file time_point.h.

67 { return ticks_ != other.ticks_; }

◆ operator+()

TimePoint fml::TimePoint::operator+ ( TimeDelta  duration) const
inline

Definition at line 59 of file time_point.h.

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

59  {
60  return TimePoint(ticks_ + duration.ToNanoseconds());
61  }
constexpr TimePoint()=default

◆ operator-() [1/2]

TimeDelta fml::TimePoint::operator- ( TimePoint  other) const
inline

Definition at line 55 of file time_point.h.

References fml::TimeDelta::FromNanoseconds().

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

◆ operator-() [2/2]

TimePoint fml::TimePoint::operator- ( TimeDelta  duration) const
inline

Definition at line 62 of file time_point.h.

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

62  {
63  return TimePoint(ticks_ - duration.ToNanoseconds());
64  }
constexpr TimePoint()=default

◆ operator<()

bool fml::TimePoint::operator< ( TimePoint  other) const
inline

Definition at line 68 of file time_point.h.

68 { return ticks_ < other.ticks_; }

◆ operator<=()

bool fml::TimePoint::operator<= ( TimePoint  other) const
inline

Definition at line 69 of file time_point.h.

69 { return ticks_ <= other.ticks_; }

◆ operator==()

bool fml::TimePoint::operator== ( TimePoint  other) const
inline

Definition at line 66 of file time_point.h.

66 { return ticks_ == other.ticks_; }

◆ operator>()

bool fml::TimePoint::operator> ( TimePoint  other) const
inline

Definition at line 70 of file time_point.h.

70 { return ticks_ > other.ticks_; }

◆ operator>=()

bool fml::TimePoint::operator>= ( TimePoint  other) const
inline

Definition at line 71 of file time_point.h.

References TimePoint().

71 { return ticks_ >= other.ticks_; }

◆ SetClockSource()

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

Definition at line 45 of file time_point.cc.

Referenced by DartVMInitializer::Initialize().

45  {
46  gSteadyClockSource = source;
47 }

◆ ToEpochDelta()


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