Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: src/gpu/GrTest.cpp

Issue 1495543003: Wire up resource cache stats dumping in nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix windows warnings Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrTest.h" 9 #include "GrTest.h"
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 fGpu->stats()->reset(); 98 fGpu->stats()->reset();
99 #endif 99 #endif
100 } 100 }
101 101
102 void GrContext::dumpCacheStats(SkString* out) const { 102 void GrContext::dumpCacheStats(SkString* out) const {
103 #if GR_CACHE_STATS 103 #if GR_CACHE_STATS
104 fResourceCache->dumpStats(out); 104 fResourceCache->dumpStats(out);
105 #endif 105 #endif
106 } 106 }
107 107
108 void GrContext::dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys,
109 SkTArray<double>* values) const {
110 #if GR_CACHE_STATS
111 fResourceCache->dumpStatsKeyValuePairs(keys, values);
112 #endif
113 }
114
108 void GrContext::printCacheStats() const { 115 void GrContext::printCacheStats() const {
109 SkString out; 116 SkString out;
110 this->dumpCacheStats(&out); 117 this->dumpCacheStats(&out);
111 SkDebugf("%s", out.c_str()); 118 SkDebugf("%s", out.c_str());
112 } 119 }
113 120
114 void GrContext::dumpGpuStats(SkString* out) const { 121 void GrContext::dumpGpuStats(SkString* out) const {
115 #if GR_GPU_STATS 122 #if GR_GPU_STATS
116 return fGpu->stats()->dump(out); 123 return fGpu->stats()->dump(out);
117 #endif 124 #endif
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 out->appendf("\t\tEntry Count: current %d" 217 out->appendf("\t\tEntry Count: current %d"
211 " (%d budgeted, %d external(%d borrowed, %d adopted), %d locked , %d scratch %.2g%% full), high %d\n", 218 " (%d budgeted, %d external(%d borrowed, %d adopted), %d locked , %d scratch %.2g%% full), high %d\n",
212 stats.fTotal, fBudgetedCount, stats.fExternal, stats.fBorrowed, 219 stats.fTotal, fBudgetedCount, stats.fExternal, stats.fBorrowed,
213 stats.fAdopted, stats.fNumNonPurgeable, stats.fScratch, countUt ilization, 220 stats.fAdopted, stats.fNumNonPurgeable, stats.fScratch, countUt ilization,
214 fHighWaterCount); 221 fHighWaterCount);
215 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbu dgeted) high %d\n", 222 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbu dgeted) high %d\n",
216 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization, 223 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization,
217 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); 224 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes));
218 } 225 }
219 226
227 void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys,
228 SkTArray<double>* values) const {
229 this->validate();
230
231 Stats stats;
232 this->getStats(&stats);
233
234 keys->push_back(SkString("gpu_cache_total_entries")); values->push_back(stat s.fTotal);
235 keys->push_back(SkString("gpu_cache_external_entries")); values->push_back(s tats.fExternal);
236 keys->push_back(SkString("gpu_cache_borrowed_entries")); values->push_back(s tats.fBorrowed);
237 keys->push_back(SkString("gpu_cache_adopted_entries")); values->push_back(st ats.fAdopted);
238 keys->push_back(SkString("gpu_cache_purgable_entries")); values->push_back(s tats.fNumPurgeable);
239 keys->push_back(SkString("gpu_cache_non_purgable_entries")); values->push_ba ck(stats.fNumNonPurgeable);
240 keys->push_back(SkString("gpu_cache_scratch_entries")); values->push_back(st ats.fScratch);
241 keys->push_back(SkString("gpu_cache_unbudgeted_size")); values->push_back((d ouble)stats.fUnbudgetedSize);
242 }
243
220 #endif 244 #endif
221 245
222 /////////////////////////////////////////////////////////////////////////////// 246 ///////////////////////////////////////////////////////////////////////////////
223 247
224 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT imestamp; } 248 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT imestamp; }
225 249
226 /////////////////////////////////////////////////////////////////////////////// 250 ///////////////////////////////////////////////////////////////////////////////
227 // Code for the mock context. It's built on a mock GrGpu class that does nothing . 251 // Code for the mock context. It's built on a mock GrGpu class that does nothing .
228 //// 252 ////
229 253
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 SkASSERT(nullptr == fGpu); 365 SkASSERT(nullptr == fGpu);
342 fGpu = new MockGpu(this, options); 366 fGpu = new MockGpu(this, options);
343 SkASSERT(fGpu); 367 SkASSERT(fGpu);
344 this->initCommon(options); 368 this->initCommon(options);
345 369
346 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 370 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
347 // these objects are required for any of tests that use this context. TODO: make stop allocating 371 // these objects are required for any of tests that use this context. TODO: make stop allocating
348 // resources in the buffer pools. 372 // resources in the buffer pools.
349 fDrawingManager->abandon(); 373 fDrawingManager->abandon();
350 } 374 }
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698