OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 | |
robertphillips
2015/12/02 21:02:13
Would it make sense for all these to have the same
joshualitt
2015/12/02 21:28:37
Acknowledged.
| |
234 keys->push_back(SkString("total_cache_entries")); values->push_back(stats.fT otal); | |
235 keys->push_back(SkString("external_cache_entries")); values->push_back(stats .fExternal); | |
236 keys->push_back(SkString("borrowed_cache_entries")); values->push_back(stats .fBorrowed); | |
237 keys->push_back(SkString("adopted_cache_entries")); values->push_back(stats. fAdopted); | |
robertphillips
2015/12/02 21:02:13
fNumPurgeable too ?
joshualitt
2015/12/02 21:28:37
Acknowledged.
| |
238 keys->push_back(SkString("non_purgable_cache_entries")); values->push_back(s tats.fNumNonPurgeable); | |
239 keys->push_back(SkString("scratch_cache_entries")); values->push_back(stats. fScratch); | |
240 keys->push_back(SkString("cache_unbudgeted_size")); values->push_back(stats. fUnbudgetedSize); | |
241 } | |
242 | |
220 #endif | 243 #endif |
221 | 244 |
222 /////////////////////////////////////////////////////////////////////////////// | 245 /////////////////////////////////////////////////////////////////////////////// |
223 | 246 |
224 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT imestamp; } | 247 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT imestamp; } |
225 | 248 |
226 /////////////////////////////////////////////////////////////////////////////// | 249 /////////////////////////////////////////////////////////////////////////////// |
227 // Code for the mock context. It's built on a mock GrGpu class that does nothing . | 250 // Code for the mock context. It's built on a mock GrGpu class that does nothing . |
228 //// | 251 //// |
229 | 252 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 SkASSERT(nullptr == fGpu); | 364 SkASSERT(nullptr == fGpu); |
342 fGpu = new MockGpu(this, options); | 365 fGpu = new MockGpu(this, options); |
343 SkASSERT(fGpu); | 366 SkASSERT(fGpu); |
344 this->initCommon(options); | 367 this->initCommon(options); |
345 | 368 |
346 // We delete these because we want to test the cache starting with zero reso urces. Also, none of | 369 // 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 | 370 // these objects are required for any of tests that use this context. TODO: make stop allocating |
348 // resources in the buffer pools. | 371 // resources in the buffer pools. |
349 fDrawingManager->abandon(); | 372 fDrawingManager->abandon(); |
350 } | 373 } |
OLD | NEW |