diff options
author | joshualitt <joshualitt@chromium.org> | 2015-12-02 14:08:25 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-02 14:08:25 -0800 |
commit | dc5685ac3752e90dd68179e9f1675ff6f15ed600 (patch) | |
tree | 36154fd45267192cd654370f6bfcbac19eadc508 | |
parent | 7384d0785575db3e6f670b95bb303d17b057d87a (diff) |
Wire up resource cache stats dumping in nanobench
TBR=bsalomon@google.com
BUG=skia:
Review URL: https://codereview.chromium.org/1495543003
-rw-r--r-- | bench/SKPBench.cpp | 1 | ||||
-rw-r--r-- | include/gpu/GrContext.h | 3 | ||||
-rw-r--r-- | src/gpu/GrResourceCache.h | 2 | ||||
-rw-r--r-- | src/gpu/GrTest.cpp | 24 |
4 files changed, 29 insertions, 1 deletions
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp index 6f4c688d23..db55b45f43 100644 --- a/bench/SKPBench.cpp +++ b/bench/SKPBench.cpp @@ -167,6 +167,7 @@ static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPic int offset = keys->count(); context->dumpGpuStatsKeyValuePairs(keys, values); + context->dumpCacheStatsKeyValuePairs(keys, values); // append tag, but only to new tags for (int i = offset; i < keys->count(); i++, offset++) { diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index df96592e07..70e7b9f244 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -335,11 +335,12 @@ public: /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ void dumpCacheStats(SkString*) const; + void dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) const; void printCacheStats() const; /** Prints GPU stats to the string if GR_GPU_STATS == 1. */ void dumpGpuStats(SkString*) const; - void dumpGpuStatsKeyValuePairs(SkTArray<SkString>* names, SkTArray<double>* values) const; + void dumpGpuStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) const; void printGpuStats() const; /** Specify the TextBlob cache limit. If the current cache exceeds this limit it will purge. diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h index ed2affeae3..a495f565b2 100644 --- a/src/gpu/GrResourceCache.h +++ b/src/gpu/GrResourceCache.h @@ -229,6 +229,8 @@ public: void getStats(Stats*) const; void dumpStats(SkString*) const; + + void dumpStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* value) const; #endif // This function is for unit testing and is only defined in test tools. diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp index f8249e8d12..a3823dd8a2 100644 --- a/src/gpu/GrTest.cpp +++ b/src/gpu/GrTest.cpp @@ -105,6 +105,13 @@ void GrContext::dumpCacheStats(SkString* out) const { #endif } +void GrContext::dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys, + SkTArray<double>* values) const { +#if GR_CACHE_STATS + fResourceCache->dumpStatsKeyValuePairs(keys, values); +#endif +} + void GrContext::printCacheStats() const { SkString out; this->dumpCacheStats(&out); @@ -217,6 +224,23 @@ void GrResourceCache::dumpStats(SkString* out) const { SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); } +void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys, + SkTArray<double>* values) const { + this->validate(); + + Stats stats; + this->getStats(&stats); + + keys->push_back(SkString("gpu_cache_total_entries")); values->push_back(stats.fTotal); + keys->push_back(SkString("gpu_cache_external_entries")); values->push_back(stats.fExternal); + keys->push_back(SkString("gpu_cache_borrowed_entries")); values->push_back(stats.fBorrowed); + keys->push_back(SkString("gpu_cache_adopted_entries")); values->push_back(stats.fAdopted); + keys->push_back(SkString("gpu_cache_purgable_entries")); values->push_back(stats.fNumPurgeable); + keys->push_back(SkString("gpu_cache_non_purgable_entries")); values->push_back(stats.fNumNonPurgeable); + keys->push_back(SkString("gpu_cache_scratch_entries")); values->push_back(stats.fScratch); + keys->push_back(SkString("gpu_cache_unbudgeted_size")); values->push_back((double)stats.fUnbudgetedSize); +} + #endif /////////////////////////////////////////////////////////////////////////////// |