Move all debug flags in a single place.
This change also adds a new memory usage flag. When turned on, the
following is printed after every frame:
D/OpenGLRenderer( 3723): Current memory usage / total memory usage (bytes):
D/OpenGLRenderer( 3723): TextureCache 3766680 / 20971520
D/OpenGLRenderer( 3723): LayerCache 3538944 / 8388608
D/OpenGLRenderer( 3723): GradientCache 135168 / 524288
D/OpenGLRenderer( 3723): PathCache 41180 / 4194304
D/OpenGLRenderer( 3723): TextDropShadowCache 0 / 2097152
D/OpenGLRenderer( 3723): FontRenderer 0 262144 / 262144
D/OpenGLRenderer( 3723): FontRenderer 1 262144 / 262144
D/OpenGLRenderer( 3723): FontRenderer 2 262144 / 262144
D/OpenGLRenderer( 3723): Other:
D/OpenGLRenderer( 3723): FboCache 2 / 12
D/OpenGLRenderer( 3723): PatchCache 31 / 512
D/OpenGLRenderer( 3723): Total memory usage:
D/OpenGLRenderer( 3723): 8268404 bytes, 7.89 MB
This should help tracking possibe memory issues.
Change-Id: I83f483ca1d2dbef904829bce368e33fe5503e8d6
diff --git a/libs/hwui/PatchCache.h b/libs/hwui/PatchCache.h
index deba40d..c38cd99 100644
--- a/libs/hwui/PatchCache.h
+++ b/libs/hwui/PatchCache.h
@@ -19,6 +19,7 @@
#include <utils/KeyedVector.h>
+#include "Debug.h"
#include "Patch.h"
namespace android {
@@ -29,9 +30,6 @@
///////////////////////////////////////////////////////////////////////////////
// Debug
-#define DEBUG_PATCHES 0
-
-// Debug
#if DEBUG_PATCHES
#define PATCH_LOGD(...) LOGD(__VA_ARGS__)
#else
@@ -54,6 +52,14 @@
const uint32_t width, const uint32_t height, const int8_t numColors);
void clear();
+ uint32_t getSize() const {
+ return mCache.size();
+ }
+
+ uint32_t getMaxSize() const {
+ return mMaxEntries;
+ }
+
private:
uint32_t mMaxEntries;
KeyedVector<PatchDescription, Patch*> mCache;