aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-12-02 09:05:37 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-02 09:05:38 -0800
commite45c81c8f3bb62e45f2ff3b8772b4b23f1ddc6ca (patch)
treefba6f2308c97b0ff2b611447a2d78e32f990be89 /src/gpu
parent6ee690e1d838e152c134257bdd57e9a1509ee7c2 (diff)
Began logging more gpu stats from nanobench
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrGpu.h4
-rw-r--r--src/gpu/GrTest.cpp23
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