diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrGpu.h | 4 | ||||
-rw-r--r-- | src/gpu/GrTest.cpp | 23 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index c5fa61bd99..dd33cff39f 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -342,6 +342,7 @@ public: void incStencilAttachmentCreates() { fStencilAttachmentCreates++; } void incNumDraws() { fNumDraws++; } void dump(SkString*); + void dumpKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values); private: int fRenderTargetBinds; @@ -351,7 +352,8 @@ public: int fStencilAttachmentCreates; int fNumDraws; #else - void dump(SkString*) {}; + void dump(SkString*) {} + void dumpKeyValuePairs(SkTArray<SkString>*, SkTArray<double>*) {} void incRenderTargetBinds() {} void incShaderCompilations() {} void incTextureCreates() {} diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp index b0d92fec30..29b13c7b7c 100644 --- a/src/gpu/GrTest.cpp +++ b/src/gpu/GrTest.cpp @@ -93,6 +93,12 @@ void GrContext::purgeAllUnlockedResources() { fResourceCache->purgeAllUnlocked(); } +void GrContext::resetGpuStats() const { +#if GR_GPU_STATS + fGpu->stats()->reset(); +#endif +} + void GrContext::dumpCacheStats(SkString* out) const { #if GR_CACHE_STATS fResourceCache->dumpStats(out); @@ -111,6 +117,13 @@ void GrContext::dumpGpuStats(SkString* out) const { #endif } +void GrContext::dumpGpuStatsKeyValuePairs(SkTArray<SkString>* keys, + SkTArray<double>* values) const { +#if GR_GPU_STATS + return fGpu->stats()->dumpKeyValuePairs(keys, values); +#endif +} + void GrContext::printGpuStats() const { SkString out; this->dumpGpuStats(&out); @@ -155,6 +168,16 @@ void GrGpu::Stats::dump(SkString* out) { out->appendf("Stencil Buffer Creates: %d\n", fStencilAttachmentCreates); out->appendf("Number of draws: %d\n", fNumDraws); } + +void GrGpu::Stats::dumpKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) { + keys->push_back(SkString("render_target_binds")); values->push_back(fRenderTargetBinds); + keys->push_back(SkString("shader_compilations")); values->push_back(fShaderCompilations); + keys->push_back(SkString("textures_created")); values->push_back(fTextureCreates); + keys->push_back(SkString("texture_uploads")); values->push_back(fTextureUploads); + keys->push_back(SkString("stencil_buffer_creates")); values->push_back(fStencilAttachmentCreates); + keys->push_back(SkString("number_of_draws")); values->push_back(fNumDraws); +} + #endif #if GR_CACHE_STATS |