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

Public Member Functions

 TopoSortBench ()
 
 ~TopoSortBench () override
 
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 17 of file TopoSortBench.cpp.

Constructor & Destructor Documentation

◆ TopoSortBench()

TopoSortBench::TopoSortBench ( )
inline

Definition at line 19 of file TopoSortBench.cpp.

19{ }

◆ ~TopoSortBench()

TopoSortBench::~TopoSortBench ( )
inlineoverride

Definition at line 21 of file TopoSortBench.cpp.

21 {
22 }

Member Function Documentation

◆ isSuitableFor()

bool TopoSortBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 24 of file TopoSortBench.cpp.

24 {
26 }
const char * backend

◆ onDelayedSetup()

void TopoSortBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 34 of file TopoSortBench.cpp.

34 {
35 ToolUtils::TopoTestNode::AllocNodes(&fGraph, kNumElements);
36
37 for (int i = kNumElements-1; i > 0; --i) {
38 int numEdges = fRand.nextU() % (kMaxEdges+1);
39
40 for (int j = 0; j < numEdges; ++j) {
41 int dep = fRand.nextU() % i;
42
43 fGraph[i]->dependsOn(fGraph[dep].get());
44 }
45 }
46 }
uint32_t nextU()
Definition: SkRandom.h:42
static void AllocNodes(skia_private::TArray< sk_sp< ToolUtils::TopoTestNode > > *graph, int num)
Definition: ToolUtils.h:229
const myers::Point & get(const myers::Segment &)

◆ onDraw()

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

Implements Benchmark.

Definition at line 48 of file TopoSortBench.cpp.

48 {
49 for (int i = 0; i < loops; ++i) {
50 for (int j = 0; j < fGraph.size(); ++j) {
51 fGraph[j]->reset();
52 }
53
55
56 SkDEBUGCODE(bool actualResult =) GrTTopoSort<ToolUtils::TopoTestNode>(fGraph);
57 SkASSERT(actualResult);
58
59#ifdef SK_DEBUG
60 for (int j = 0; j < fGraph.size(); ++j) {
61 SkASSERT(fGraph[j]->check());
62 }
63#endif
64 }
65 }
bool GrTTopoSort(SkSpan< sk_sp< T > > graph, uint32_t offset=0)
Definition: GrTTopoSort.h:92
#define check(reporter, ref, unref, make, kill)
Definition: RefCntTest.cpp:85
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static void Shuffle(SkSpan< sk_sp< TopoTestNode > > graph, SkRandom *rand)
Definition: ToolUtils.h:247
void reset(int n)
Definition: SkTArray.h:144
int size() const
Definition: SkTArray.h:421

◆ onGetName()

const char * TopoSortBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 29 of file TopoSortBench.cpp.

29 {
30 return "sort_topo_rand";
31 }

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