Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
skiatest::Timer Class Reference

#include <Test.h>

Public Member Functions

 Timer ()
 
double elapsedNs () const
 
double elapsedMs () const
 
SkMSec elapsedMsInt () const
 

Detailed Description

Timer provides wall-clock duration since its creation.

Definition at line 246 of file Test.h.

Constructor & Destructor Documentation

◆ Timer()

skiatest::Timer::Timer ( )

Starts the timer.

Definition at line 74 of file Test.cpp.

74: fStartNanos(SkTime::GetNSecs()) {}
double GetNSecs()
Definition: SkTime.cpp:17

Member Function Documentation

◆ elapsedMs()

double skiatest::Timer::elapsedMs ( ) const

Milliseconds since creation.

Definition at line 80 of file Test.cpp.

80{ return this->elapsedNs() * 1e-6; }
double elapsedNs() const
Definition: Test.cpp:76

◆ elapsedMsInt()

SkMSec skiatest::Timer::elapsedMsInt ( ) const

Milliseconds since creation as an integer. Behavior is undefined for durations longer than SK_MSecMax.

Definition at line 82 of file Test.cpp.

82 {
83 const double elapsedMs = this->elapsedMs();
84 SkASSERT(SK_MSecMax >= elapsedMs);
85 return static_cast<SkMSec>(elapsedMs);
86}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static constexpr SkMSec SK_MSecMax
Definition: SkTypes.h:188
uint32_t SkMSec
Definition: SkTypes.h:184
double elapsedMs() const
Definition: Test.cpp:80

◆ elapsedNs()

double skiatest::Timer::elapsedNs ( ) const

Nanoseconds since creation.

Definition at line 76 of file Test.cpp.

76 {
77 return SkTime::GetNSecs() - fStartNanos;
78}

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