Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Private Member Functions | List of all members
sk_gpu_test::GpuTimer Class Referenceabstract

#include <GpuTimer.h>

Public Types

enum class  QueryStatus { kInvalid , kPending , kDisjoint , kAccurate }
 

Public Member Functions

 GpuTimer (bool disjointSupport)
 
virtual ~GpuTimer ()
 
bool disjointSupport () const
 
void queueStart ()
 
PlatformTimerQuery queueStop ()
 
virtual QueryStatus checkQueryStatus (PlatformTimerQuery)=0
 
virtual std::chrono::nanoseconds getTimeElapsed (PlatformTimerQuery)=0
 
virtual void deleteQuery (PlatformTimerQuery)=0
 

Private Member Functions

virtual PlatformTimerQuery onQueueTimerStart () const =0
 
virtual void onQueueTimerStop (PlatformTimerQuery) const =0
 

Detailed Description

Platform-independent interface for timing operations on the GPU.

Definition at line 23 of file GpuTimer.h.

Member Enumeration Documentation

◆ QueryStatus

Enumerator
kInvalid 
kPending 
kDisjoint 
kAccurate 

Definition at line 56 of file GpuTimer.h.

56 {
57 kInvalid, //<! the timer query is invalid.
58 kPending, //<! the timer is still running on the GPU.
59 kDisjoint, //<! the query is complete, but dubious due to disjoint GPU operations.
60 kAccurate //<! the query is complete and reliable.
61 };
@ kInvalid

Constructor & Destructor Documentation

◆ GpuTimer()

sk_gpu_test::GpuTimer::GpuTimer ( bool  disjointSupport)
inline

Definition at line 25 of file GpuTimer.h.

26 : fDisjointSupport(disjointSupport)
27 , fActiveTimer(kInvalidTimerQuery) {
28 }
bool disjointSupport() const
Definition: GpuTimer.h:35
static constexpr PlatformTimerQuery kInvalidTimerQuery
Definition: GpuTimer.h:18

◆ ~GpuTimer()

virtual sk_gpu_test::GpuTimer::~GpuTimer ( )
inlinevirtual

Definition at line 29 of file GpuTimer.h.

29{ SkASSERT(!fActiveTimer); }
#define SkASSERT(cond)
Definition: SkAssert.h:116

Member Function Documentation

◆ checkQueryStatus()

virtual QueryStatus sk_gpu_test::GpuTimer::checkQueryStatus ( PlatformTimerQuery  )
pure virtual

◆ deleteQuery()

virtual void sk_gpu_test::GpuTimer::deleteQuery ( PlatformTimerQuery  )
pure virtual

◆ disjointSupport()

bool sk_gpu_test::GpuTimer::disjointSupport ( ) const
inline

Returns whether this timer can detect disjoint GPU operations while timing. If false, a query has less confidence when it completes with QueryStatus::kAccurate.

Definition at line 35 of file GpuTimer.h.

35{ return fDisjointSupport; }

◆ getTimeElapsed()

virtual std::chrono::nanoseconds sk_gpu_test::GpuTimer::getTimeElapsed ( PlatformTimerQuery  )
pure virtual

◆ onQueueTimerStart()

virtual PlatformTimerQuery sk_gpu_test::GpuTimer::onQueueTimerStart ( ) const
privatepure virtual

◆ onQueueTimerStop()

virtual void sk_gpu_test::GpuTimer::onQueueTimerStop ( PlatformTimerQuery  ) const
privatepure virtual

◆ queueStart()

void sk_gpu_test::GpuTimer::queueStart ( )
inline

Inserts a "start timing" command in the GPU command stream.

Definition at line 40 of file GpuTimer.h.

40 {
41 SkASSERT(!fActiveTimer);
42 fActiveTimer = this->onQueueTimerStart();
43 }
virtual PlatformTimerQuery onQueueTimerStart() const =0

◆ queueStop()

PlatformTimerQuery sk_gpu_test::GpuTimer::queueStop ( )
inline

Inserts a "stop timing" command in the GPU command stream.

Returns
a query object that can retrieve the time elapsed once the timer has completed.

Definition at line 50 of file GpuTimer.h.

50 {
51 SkASSERT(fActiveTimer);
52 this->onQueueTimerStop(fActiveTimer);
53 return std::exchange(fActiveTimer, kInvalidTimerQuery);
54 }
virtual void onQueueTimerStop(PlatformTimerQuery) const =0

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