| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrTest.h" | 8 #include "GrTest.h" |
| 9 | 9 |
| 10 #include "GrBatchAtlas.h" | 10 #include "GrBatchAtlas.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 out->appendf("Textures Created: %d\n", fTextureCreates); | 179 out->appendf("Textures Created: %d\n", fTextureCreates); |
| 180 out->appendf("Texture Uploads: %d\n", fTextureUploads); | 180 out->appendf("Texture Uploads: %d\n", fTextureUploads); |
| 181 out->appendf("Transfers to Texture: %d\n", fTransfersToTexture); | 181 out->appendf("Transfers to Texture: %d\n", fTransfersToTexture); |
| 182 out->appendf("Stencil Buffer Creates: %d\n", fStencilAttachmentCreates); | 182 out->appendf("Stencil Buffer Creates: %d\n", fStencilAttachmentCreates); |
| 183 out->appendf("Number of draws: %d\n", fNumDraws); | 183 out->appendf("Number of draws: %d\n", fNumDraws); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void GrGpu::Stats::dumpKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>*
values) { | 186 void GrGpu::Stats::dumpKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>*
values) { |
| 187 keys->push_back(SkString("render_target_binds")); values->push_back(fRenderT
argetBinds); | 187 keys->push_back(SkString("render_target_binds")); values->push_back(fRenderT
argetBinds); |
| 188 keys->push_back(SkString("shader_compilations")); values->push_back(fShaderC
ompilations); | 188 keys->push_back(SkString("shader_compilations")); values->push_back(fShaderC
ompilations); |
| 189 keys->push_back(SkString("textures_created")); values->push_back(fTextureCre
ates); | |
| 190 keys->push_back(SkString("texture_uploads")); values->push_back(fTextureUplo
ads); | 189 keys->push_back(SkString("texture_uploads")); values->push_back(fTextureUplo
ads); |
| 191 keys->push_back(SkString("transfers_to_texture")); values->push_back(fTransf
ersToTexture); | |
| 192 keys->push_back(SkString("stencil_buffer_creates")); values->push_back(fSten
cilAttachmentCreates); | |
| 193 keys->push_back(SkString("number_of_draws")); values->push_back(fNumDraws); | 190 keys->push_back(SkString("number_of_draws")); values->push_back(fNumDraws); |
| 194 } | 191 } |
| 195 | 192 |
| 196 #endif | 193 #endif |
| 197 | 194 |
| 198 #if GR_CACHE_STATS | 195 #if GR_CACHE_STATS |
| 199 void GrResourceCache::getStats(Stats* stats) const { | 196 void GrResourceCache::getStats(Stats* stats) const { |
| 200 stats->reset(); | 197 stats->reset(); |
| 201 | 198 |
| 202 stats->fTotal = this->getResourceCount(); | 199 stats->fTotal = this->getResourceCount(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 232 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); | 229 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); |
| 233 } | 230 } |
| 234 | 231 |
| 235 void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys, | 232 void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys, |
| 236 SkTArray<double>* values) const { | 233 SkTArray<double>* values) const { |
| 237 this->validate(); | 234 this->validate(); |
| 238 | 235 |
| 239 Stats stats; | 236 Stats stats; |
| 240 this->getStats(&stats); | 237 this->getStats(&stats); |
| 241 | 238 |
| 242 keys->push_back(SkString("gpu_cache_total_entries")); values->push_back(stat
s.fTotal); | |
| 243 keys->push_back(SkString("gpu_cache_external_entries")); values->push_back(s
tats.fExternal); | |
| 244 keys->push_back(SkString("gpu_cache_borrowed_entries")); values->push_back(s
tats.fBorrowed); | |
| 245 keys->push_back(SkString("gpu_cache_adopted_entries")); values->push_back(st
ats.fAdopted); | |
| 246 keys->push_back(SkString("gpu_cache_purgable_entries")); values->push_back(s
tats.fNumPurgeable); | 239 keys->push_back(SkString("gpu_cache_purgable_entries")); values->push_back(s
tats.fNumPurgeable); |
| 247 keys->push_back(SkString("gpu_cache_non_purgable_entries")); values->push_ba
ck(stats.fNumNonPurgeable); | |
| 248 keys->push_back(SkString("gpu_cache_scratch_entries")); values->push_back(st
ats.fScratch); | |
| 249 keys->push_back(SkString("gpu_cache_unbudgeted_size")); values->push_back((d
ouble)stats.fUnbudgetedSize); | |
| 250 } | 240 } |
| 251 | 241 |
| 252 #endif | 242 #endif |
| 253 | 243 |
| 254 /////////////////////////////////////////////////////////////////////////////// | 244 /////////////////////////////////////////////////////////////////////////////// |
| 255 | 245 |
| 256 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } | 246 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } |
| 257 | 247 |
| 258 /////////////////////////////////////////////////////////////////////////////// | 248 /////////////////////////////////////////////////////////////////////////////// |
| 259 | 249 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 SkASSERT(nullptr == fGpu); | 413 SkASSERT(nullptr == fGpu); |
| 424 fGpu = new MockGpu(this, options); | 414 fGpu = new MockGpu(this, options); |
| 425 SkASSERT(fGpu); | 415 SkASSERT(fGpu); |
| 426 this->initCommon(options); | 416 this->initCommon(options); |
| 427 | 417 |
| 428 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 418 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
| 429 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 419 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
| 430 // resources in the buffer pools. | 420 // resources in the buffer pools. |
| 431 fDrawingManager->abandon(); | 421 fDrawingManager->abandon(); |
| 432 } | 422 } |
| OLD | NEW |