Romain Guy c15008e72e 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
2010-11-10 11:59:15 -08:00

72 lines
2.0 KiB
C++

/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HWUI_PATCH_CACHE_H
#define ANDROID_HWUI_PATCH_CACHE_H
#include <utils/KeyedVector.h>
#include "Debug.h"
#include "Patch.h"
namespace android {
namespace uirenderer {
///////////////////////////////////////////////////////////////////////////////
// Defines
///////////////////////////////////////////////////////////////////////////////
// Debug
#if DEBUG_PATCHES
#define PATCH_LOGD(...) LOGD(__VA_ARGS__)
#else
#define PATCH_LOGD(...)
#endif
///////////////////////////////////////////////////////////////////////////////
// Cache
///////////////////////////////////////////////////////////////////////////////
class PatchCache {
public:
PatchCache();
PatchCache(uint32_t maxCapacity);
~PatchCache();
Patch* get(const float bitmapWidth, const float bitmapHeight,
const float pixelWidth, const float pixelHeight,
const int32_t* xDivs, const int32_t* yDivs, const uint32_t* colors,
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;
}; // class PatchCache
}; // namespace uirenderer
}; // namespace android
#endif // ANDROID_HWUI_PATCH_CACHE_H