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

Public Member Functions

 GrResourceCacheBenchFind (int keyData32Count)
 
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 *canvas) 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 100 of file GrResourceCacheBench.cpp.

Constructor & Destructor Documentation

◆ GrResourceCacheBenchFind()

GrResourceCacheBenchFind::GrResourceCacheBenchFind ( int  keyData32Count)
inline

Definition at line 102 of file GrResourceCacheBench.cpp.

103 : fFullName("grresourcecache_find")
104 , fKeyData32Count(keyData32Count) {
105 if (keyData32Count > 1) {
106 fFullName.appendf("_%d", fKeyData32Count);
107 }
108 }
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:550

Member Function Documentation

◆ isSuitableFor()

bool GrResourceCacheBenchFind::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 110 of file GrResourceCacheBench.cpp.

110 {
112 }
const char * backend

◆ onDelayedSetup()

void GrResourceCacheBenchFind::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 118 of file GrResourceCacheBench.cpp.

118 {
119 fContext = GrDirectContext::MakeMock(nullptr);
120 if (!fContext) {
121 return;
122 }
123 // Set the cache budget to be very large so no purging occurs.
124 fContext->setResourceCacheLimits(CACHE_SIZE_COUNT, 1 << 30);
125
127
128 // Make sure the cache is empty.
129 cache->purgeUnlockedResources(GrPurgeResourceOptions::kAllResources);
130 SkASSERT(0 == cache->getResourceCount() && 0 == cache->getResourceBytes());
131
132 GrGpu* gpu = fContext->priv().getGpu();
133
134 populate_cache(gpu, CACHE_SIZE_COUNT, fKeyData32Count);
135 }
static void populate_cache(GrGpu *gpu, int resourceCount, int keyData32Count)
@ CACHE_SIZE_COUNT
#define SkASSERT(cond)
Definition: SkAssert.h:116
GrResourceCache * getResourceCache()
void setResourceCacheLimits(int maxResources, size_t maxResourceBytes)
static sk_sp< GrDirectContext > MakeMock(const GrMockOptions *, const GrContextOptions &)
GrDirectContextPriv priv()
Definition: GrGpu.h:62
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
Definition: switches.h:191

◆ onDraw()

void GrResourceCacheBenchFind::onDraw ( int  loops,
SkCanvas canvas 
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 137 of file GrResourceCacheBench.cpp.

137 {
138 if (!fContext) {
139 return;
140 }
142 SkASSERT(CACHE_SIZE_COUNT == cache->getResourceCount());
143 for (int i = 0; i < loops; ++i) {
144 for (int k = 0; k < CACHE_SIZE_COUNT; ++k) {
146 BenchResource::ComputeKey(k, fKeyData32Count, &key);
147 sk_sp<GrGpuResource> resource(cache->findAndRefUniqueResource(key));
149 }
150 }
151 }
static SkString resource(SkPDFResourceType type, int index)
static void ComputeKey(int i, int keyData32Count, skgpu::UniqueKey *key)

◆ onGetName()

const char * GrResourceCacheBenchFind::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 114 of file GrResourceCacheBench.cpp.

114 {
115 return fFullName.c_str();
116 }
const char * c_str() const
Definition: SkString.h:133

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