diff options
author | 2012-08-31 13:07:37 +0000 | |
---|---|---|
committer | 2012-08-31 13:07:37 +0000 | |
commit | 5955202c805c7ef1448103cbf666972ea9d1ded1 (patch) | |
tree | a52138986487e576f4fef63652ec690d2a7e125d /src | |
parent | dc1a3badc702dd47d903863208315ddda660dbb9 (diff) |
Allow cache tracking to be enabled in release
https://codereview.appspot.com/6500057/
git-svn-id: http://skia.googlecode.com/svn/trunk@5365 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrResourceCache.cpp | 13 | ||||
-rw-r--r-- | src/gpu/GrResourceCache.h | 8 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 6a4a5579db..2c724b51ee 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -1964,7 +1964,7 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, } /////////////////////////////////////////////////////////////////////////////// -#if GR_DEBUG +#if GR_CACHE_STATS void GrContext::printCacheStats() const { fTextureCache->printStats(); } diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp index 3a3bd73448..ee127c846c 100644 --- a/src/gpu/GrResourceCache.cpp +++ b/src/gpu/GrResourceCache.cpp @@ -68,7 +68,7 @@ public: GrResourceCache::GrResourceCache(int maxCount, size_t maxBytes) : fMaxCount(maxCount), fMaxBytes(maxBytes) { -#if GR_DEBUG +#if GR_CACHE_STATS fHighWaterEntryCount = 0; fHighWaterUnlockedEntryCount = 0; fHighWaterEntryBytes = 0; @@ -137,7 +137,7 @@ void GrResourceCache::internalDetach(GrResourceEntry* entry, fClientDetachedCount += 1; fClientDetachedBytes += entry->resource()->sizeInBytes(); -#if GR_DEBUG +#if GR_CACHE_STATS if (fHighWaterClientDetachedCount < fClientDetachedCount) { fHighWaterClientDetachedCount = fClientDetachedCount; } @@ -158,7 +158,7 @@ void GrResourceCache::attachToHead(GrResourceEntry* entry, if (!entry->isLocked()) { ++fUnlockedEntryCount; -#if GR_DEBUG +#if GR_CACHE_STATS if (fHighWaterUnlockedEntryCount < fUnlockedEntryCount) { fHighWaterUnlockedEntryCount = fUnlockedEntryCount; } @@ -173,7 +173,7 @@ void GrResourceCache::attachToHead(GrResourceEntry* entry, fEntryCount += 1; fEntryBytes += entry->resource()->sizeInBytes(); -#if GR_DEBUG +#if GR_CACHE_STATS if (fHighWaterEntryCount < fEntryCount) { fHighWaterEntryCount = fEntryCount; } @@ -308,7 +308,7 @@ void GrResourceCache::unlock(GrResourceEntry* entry) { entry->unlock(); if (!entry->isLocked()) { ++fUnlockedEntryCount; -#if GR_DEBUG +#if GR_CACHE_STATS if (fHighWaterUnlockedEntryCount < fUnlockedEntryCount) { fHighWaterUnlockedEntryCount = fUnlockedEntryCount; } @@ -472,6 +472,9 @@ void GrResourceCache::validate() const { GrAssert(fExclusiveList.countEntries() == fClientDetachedCount); } +#endif // GR_DEBUG + +#if GR_CACHE_STATS void GrResourceCache::printStats() const { SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h index 00e62ea923..bfa528d305 100644 --- a/src/gpu/GrResourceCache.h +++ b/src/gpu/GrResourceCache.h @@ -11,6 +11,7 @@ #ifndef GrResourceCache_DEFINED #define GrResourceCache_DEFINED +#include "GrConfig.h" #include "GrTypes.h" #include "GrTHashCache.h" #include "SkTDLinkedList.h" @@ -297,11 +298,14 @@ public: #if GR_DEBUG void validate() const; - void printStats() const; #else void validate() const {} #endif +#if GR_CACHE_STATS + void printStats() const; +#endif + private: void internalDetach(GrResourceEntry*, bool); void attachToHead(GrResourceEntry*, bool); @@ -326,7 +330,7 @@ private: size_t fMaxBytes; // our current stats, related to our budget -#if GR_DEBUG +#if GR_CACHE_STATS int fHighWaterEntryCount; int fHighWaterUnlockedEntryCount; size_t fHighWaterEntryBytes; |