| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 "GrResourceCache.h" | 9 #include "GrResourceCache.h" |
| 10 #include "GrGpuResource.h" | 10 #include "GrGpuResource.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 size_t bytes = this->countBytes(fList); | 397 size_t bytes = this->countBytes(fList); |
| 398 SkASSERT(bytes == fEntryBytes); | 398 SkASSERT(bytes == fEntryBytes); |
| 399 SkASSERT(fList.countEntries() == fEntryCount); | 399 SkASSERT(fList.countEntries() == fEntryCount); |
| 400 } | 400 } |
| 401 #endif // SK_DEBUG | 401 #endif // SK_DEBUG |
| 402 | 402 |
| 403 #if GR_CACHE_STATS | 403 #if GR_CACHE_STATS |
| 404 | 404 |
| 405 void GrResourceCache::printStats() { | 405 void GrResourceCache::printStats() { |
| 406 int locked = 0; | 406 int locked = 0; |
| 407 int scratch = 0; |
| 407 | 408 |
| 408 EntryList::Iter iter; | 409 EntryList::Iter iter; |
| 409 | 410 |
| 410 GrResourceCacheEntry* entry = iter.init(fList, EntryList::Iter::kTail_IterSt
art); | 411 GrResourceCacheEntry* entry = iter.init(fList, EntryList::Iter::kTail_IterSt
art); |
| 411 | 412 |
| 412 for ( ; entry; entry = iter.prev()) { | 413 for ( ; entry; entry = iter.prev()) { |
| 413 if (entry->fResource->getRefCnt() > 1) { | 414 if (!entry->fResource->isPurgable()) { |
| 414 ++locked; | 415 ++locked; |
| 415 } | 416 } |
| 417 if (entry->fResource->isScratch()) { |
| 418 ++scratch; |
| 419 } |
| 416 } | 420 } |
| 417 | 421 |
| 422 float countUtilization = (100.f * fEntryCount) / fMaxCount; |
| 423 float byteUtilization = (100.f * fEntryBytes) / fMaxBytes; |
| 424 |
| 418 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); | 425 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); |
| 419 SkDebugf("\t\tEntry Count: current %d (%d locked) high %d\n", | 426 SkDebugf("\t\tEntry Count: current %d (%d locked, %d scratch %.2g%% full), h
igh %d\n", |
| 420 fEntryCount, locked, fHighWaterEntryCount); | 427 fEntryCount, locked, scratch, countUtilization, fHighWaterEntryC
ount); |
| 421 SkDebugf("\t\tEntry Bytes: current %d high %d\n", | 428 SkDebugf("\t\tEntry Bytes: current %d (%.2g%% full) high %d\n", |
| 422 fEntryBytes, fHighWaterEntryBytes); | 429 fEntryBytes, byteUtilization, fHighWaterEntryBytes); |
| 423 } | 430 } |
| 424 | 431 |
| 425 #endif | 432 #endif |
| 426 | 433 |
| 427 /////////////////////////////////////////////////////////////////////////////// | 434 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |