Wire up resource cache stats dumping in nanobench
TBR=bsalomon@google.com BUG=skia: Review URL: https://codereview.chromium.org/1495543003
This commit is contained in:
parent
7384d07855
commit
dc5685ac37
@ -167,6 +167,7 @@ static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPic
|
|||||||
|
|
||||||
int offset = keys->count();
|
int offset = keys->count();
|
||||||
context->dumpGpuStatsKeyValuePairs(keys, values);
|
context->dumpGpuStatsKeyValuePairs(keys, values);
|
||||||
|
context->dumpCacheStatsKeyValuePairs(keys, values);
|
||||||
|
|
||||||
// append tag, but only to new tags
|
// append tag, but only to new tags
|
||||||
for (int i = offset; i < keys->count(); i++, offset++) {
|
for (int i = offset; i < keys->count(); i++, offset++) {
|
||||||
|
@ -335,11 +335,12 @@ public:
|
|||||||
|
|
||||||
/** Prints cache stats to the string if GR_CACHE_STATS == 1. */
|
/** Prints cache stats to the string if GR_CACHE_STATS == 1. */
|
||||||
void dumpCacheStats(SkString*) const;
|
void dumpCacheStats(SkString*) const;
|
||||||
|
void dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) const;
|
||||||
void printCacheStats() const;
|
void printCacheStats() const;
|
||||||
|
|
||||||
/** Prints GPU stats to the string if GR_GPU_STATS == 1. */
|
/** Prints GPU stats to the string if GR_GPU_STATS == 1. */
|
||||||
void dumpGpuStats(SkString*) const;
|
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;
|
void printGpuStats() const;
|
||||||
|
|
||||||
/** Specify the TextBlob cache limit. If the current cache exceeds this limit it will purge.
|
/** Specify the TextBlob cache limit. If the current cache exceeds this limit it will purge.
|
||||||
|
@ -229,6 +229,8 @@ public:
|
|||||||
void getStats(Stats*) const;
|
void getStats(Stats*) const;
|
||||||
|
|
||||||
void dumpStats(SkString*) const;
|
void dumpStats(SkString*) const;
|
||||||
|
|
||||||
|
void dumpStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* value) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This function is for unit testing and is only defined in test tools.
|
// This function is for unit testing and is only defined in test tools.
|
||||||
|
@ -105,6 +105,13 @@ void GrContext::dumpCacheStats(SkString* out) const {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GrContext::dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys,
|
||||||
|
SkTArray<double>* values) const {
|
||||||
|
#if GR_CACHE_STATS
|
||||||
|
fResourceCache->dumpStatsKeyValuePairs(keys, values);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void GrContext::printCacheStats() const {
|
void GrContext::printCacheStats() const {
|
||||||
SkString out;
|
SkString out;
|
||||||
this->dumpCacheStats(&out);
|
this->dumpCacheStats(&out);
|
||||||
@ -217,6 +224,23 @@ void GrResourceCache::dumpStats(SkString* out) const {
|
|||||||
SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes));
|
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
|
#endif
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user