summaryrefslogtreecommitdiffstats
path: root/core/jni/android
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2011-04-21 15:33:50 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2011-04-21 15:33:50 -0700
commit010d5c4e5ba7a229f621f08f5d1c5cbff7643402 (patch)
tree3adda30bc1ae84244c32c37de298aa05753fc7b1 /core/jni/android
parent8c4da95f6b95f3ce07485ac4e4e7640c32d2e326 (diff)
downloadframeworks_base-010d5c4e5ba7a229f621f08f5d1c5cbff7643402.zip
frameworks_base-010d5c4e5ba7a229f621f08f5d1c5cbff7643402.tar.gz
frameworks_base-010d5c4e5ba7a229f621f08f5d1c5cbff7643402.tar.bz2
TextLayout cache - update size and improve logging
- set size to 256K - add pid logging - fix percent gain computation Change-Id: Id6da4d606147294e05597022414531c346860f45
Diffstat (limited to 'core/jni/android')
-rw-r--r--core/jni/android/graphics/TextLayoutCache.cpp14
-rw-r--r--core/jni/android/graphics/TextLayoutCache.h2
2 files changed, 12 insertions, 4 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index 77a731a..df017f5 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -126,11 +126,17 @@ sp<TextLayoutCacheValue> TextLayoutCache::getValue(SkPaint* paint,
// Value not found for the key, we need to add a new value in the cache
if (value == NULL) {
+ if (mDebugEnabled) {
+ startTime = systemTime(SYSTEM_TIME_MONOTONIC);
+ }
+
value = new TextLayoutCacheValue();
// Compute advances and store them
value->computeValues(paint, text, start, count, contextCount, dirFlags);
+ nsecs_t endTime = systemTime(SYSTEM_TIME_MONOTONIC);
+
// Don't bother to add in the cache if the entry is too big
size_t size = key.getSize() + value->getSize();
if (size <= mMaxSize) {
@@ -155,7 +161,7 @@ sp<TextLayoutCacheValue> TextLayoutCache::getValue(SkPaint* paint,
if (mDebugEnabled) {
// Update timing information for statistics
- value->setElapsedTime(systemTime(SYSTEM_TIME_MONOTONIC) - startTime);
+ value->setElapsedTime(endTime - startTime);
LOGD("CACHE MISS: Added entry for text='%s' with start=%d, count=%d, "
"contextCount=%d, entry size %d bytes, remaining space %d bytes"
@@ -168,9 +174,9 @@ sp<TextLayoutCacheValue> TextLayoutCache::getValue(SkPaint* paint,
LOGD("CACHE MISS: Calculated but not storing entry because it is too big "
"for text='%s' with start=%d, count=%d, contextCount=%d, "
"entry size %d bytes, remaining space %d bytes"
- " - Compute time in nanos: %d",
+ " - Compute time in nanos: %lld",
String8(text, contextCount).string(), start, count, contextCount,
- size, mMaxSize - mSize, value->getElapsedTime());
+ size, mMaxSize - mSize, endTime);
}
value.clear();
}
@@ -205,7 +211,9 @@ void TextLayoutCache::dumpCacheStats() {
LOGD("------------------------------------------------");
LOGD("TextLayoutCache stats");
LOGD("------------------------------------------------");
+ LOGD("pid : %d", getpid());
LOGD("running : %.0f seconds", timeRunningInSec);
+ LOGD("entries : %d", mCache.size());
LOGD("size : %d bytes", mMaxSize);
LOGD("remaining : %d bytes or %2.2f percent", mMaxSize - mSize, remainingPercent);
LOGD("hits : %d", mCacheHitCount);
diff --git a/core/jni/android/graphics/TextLayoutCache.h b/core/jni/android/graphics/TextLayoutCache.h
index 62813df..690caac 100644
--- a/core/jni/android/graphics/TextLayoutCache.h
+++ b/core/jni/android/graphics/TextLayoutCache.h
@@ -53,7 +53,7 @@
#define MB(s) s * 1024 * 1024
// Define the default cache size in Mb
-#define DEFAULT_TEXT_LAYOUT_CACHE_SIZE_IN_MB 0.125f
+#define DEFAULT_TEXT_LAYOUT_CACHE_SIZE_IN_MB 0.250f
// Define the interval in number of cache hits between two statistics dump
#define DEFAULT_DUMP_STATS_CACHE_HIT_INTERVAL 100