Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SortBench Class Reference
Inheritance diagram for SortBench:
Benchmark SkRefCnt SkRefCntBase

Public Member Functions

 SortBench (Type t, SortType s)
 
bool isSuitableFor (Backend backend) override
 
- Public Member Functions inherited from Benchmark
 Benchmark ()
 
const char * getName ()
 
const char * getUniqueName ()
 
SkISize getSize ()
 
virtual bool isSuitableFor (Backend backend)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual bool shouldLoop () const
 
void delayedSetup ()
 
void perCanvasPreDraw (SkCanvas *)
 
void perCanvasPostDraw (SkCanvas *)
 
void preDraw (SkCanvas *)
 
void postDraw (SkCanvas *)
 
void draw (int loops, SkCanvas *)
 
virtual void getGpuStats (SkCanvas *, skia_private::TArray< SkString > *keys, skia_private::TArray< double > *values)
 
virtual bool getDMSAAStats (GrRecordingContext *)
 
int getUnits () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

const char * onGetName () override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *) override
 
- Protected Member Functions inherited from Benchmark
void setUnits (int units)
 
virtual void setupPaint (SkPaint *paint)
 
virtual const char * onGetName ()=0
 
virtual const char * onGetUniqueName ()
 
virtual void onDelayedSetup ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
virtual void onDraw (int loops, SkCanvas *)=0
 
virtual SkISize onGetSize ()
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Detailed Description

Definition at line 109 of file SortBench.cpp.

Constructor & Destructor Documentation

◆ SortBench()

SortBench::SortBench ( Type  t,
SortType  s 
)
inline

Definition at line 116 of file SortBench.cpp.

116 : fType(t), fSortProc(gSorts[s].fProc) {
117 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName);
118 }
static const struct @256 gSorts[]
SortProc fProc
Definition: SortBench.cpp:62
static const struct @255 gRec[]
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
struct MyStruct s

Member Function Documentation

◆ isSuitableFor()

bool SortBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 120 of file SortBench.cpp.

120 {
122 }
const char * backend

◆ onDelayedSetup()

void SortBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 130 of file SortBench.cpp.

130 {
131 fUnsorted.reset(N);
132 gRec[fType].fProc(fUnsorted.get());
133 }
static const int N
Definition: SortBench.cpp:19
T * reset(size_t count=0)
Definition: SkTemplates.h:296

◆ onDraw()

void SortBench::onDraw ( int  loops,
SkCanvas  
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 135 of file SortBench.cpp.

135 {
136 AutoTMalloc<int> sorted(N);
137 for (int i = 0; i < loops; i++) {
138 memcpy(sorted.get(), fUnsorted.get(), N*sizeof(int));
139 fSortProc(sorted.get());
140#ifdef SK_DEBUG
141 for (int j = 1; j < N; ++j) {
142 SkASSERT(sorted[j - 1] <= sorted[j]);
143 }
144#endif
145 }
146 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ onGetName()

const char * SortBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 125 of file SortBench.cpp.

125 {
126 return fName.c_str();
127 }
const char * c_str() const
Definition: SkString.h:133

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