summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2009-08-31 09:17:57 -0700
committerJean-Baptiste Queru <jbq@google.com>2009-08-31 09:17:57 -0700
commit72b1f379d5c97c8ff31d2201e78215af777d6bda (patch)
tree8be18715a615095bea90d189af9774710b33edef /core/jni
parentac1e59d887651220f5367cc7fa4207b34eab774d (diff)
downloadframeworks_base-72b1f379d5c97c8ff31d2201e78215af777d6bda.zip
frameworks_base-72b1f379d5c97c8ff31d2201e78215af777d6bda.tar.gz
frameworks_base-72b1f379d5c97c8ff31d2201e78215af777d6bda.tar.bz2
donut snapshot
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_os_Debug.cpp10
-rw-r--r--core/jni/android_util_AssetManager.cpp18
-rw-r--r--core/jni/android_util_Process.cpp19
3 files changed, 42 insertions, 5 deletions
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index a6b63d8..b4c60f1 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -129,6 +129,8 @@ static void read_mapinfo(FILE *fp, stats_t* stats)
isDalvikHeap = 1;
} else if (strstr(line, "/dalvik-heap-bitmap/")) {
isDalvikHeap = 1;
+ } else if (strstr(line, "/data/dalvik-cache/")) {
+ isDalvikHeap = 1;
} else if (strstr(line, "/tmp/sqlite-heap")) {
isSqliteHeap = 1;
}
@@ -158,9 +160,9 @@ static void read_mapinfo(FILE *fp, stats_t* stats)
private_dirty = temp;
} else if (sscanf(line, "Referenced: %d kB", &temp) == 1) {
referenced = temp;
- } else if (strlen(line) > 40 && line[8] == '-' && line[17] == ' ') {
+ } else if (strlen(line) > 30 && line[8] == '-' && line[17] == ' ') {
// looks like a new mapping
- // example: "0000a000-00232000 rwxp 0000a000 00:00 0 [heap]"
+ // example: "10000000-10001000 ---p 10000000 00:00 0"
break;
}
}
@@ -178,8 +180,8 @@ static void read_mapinfo(FILE *fp, stats_t* stats)
// ignore
} else {
stats->otherPss += pss;
- stats->otherPrivateDirty += shared_dirty;
- stats->otherSharedDirty += private_dirty;
+ stats->otherPrivateDirty += private_dirty;
+ stats->otherSharedDirty += shared_dirty;
}
}
}
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 66b2506..562cc8f 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -1536,6 +1536,22 @@ static jint android_content_AssetManager_getGlobalAssetCount(JNIEnv* env, jobjec
return Asset::getGlobalCount();
}
+static jobject android_content_AssetManager_getAssetAllocations(JNIEnv* env, jobject clazz)
+{
+ String8 alloc = Asset::getAssetAllocations();
+ if (alloc.length() <= 0) {
+ return NULL;
+ }
+
+ jstring str = env->NewStringUTF(alloc.string());
+ if (str == NULL) {
+ doThrow(env, "java/lang/OutOfMemoryError");
+ return NULL;
+ }
+
+ return str;
+}
+
static jint android_content_AssetManager_getGlobalAssetManagerCount(JNIEnv* env, jobject clazz)
{
return AssetManager::getGlobalCount();
@@ -1646,6 +1662,8 @@ static JNINativeMethod gAssetManagerMethods[] = {
(void*) android_content_AssetManager_destroy },
{ "getGlobalAssetCount", "()I",
(void*) android_content_AssetManager_getGlobalAssetCount },
+ { "getAssetAllocations", "()Ljava/lang/String;",
+ (void*) android_content_AssetManager_getAssetAllocations },
{ "getGlobalAssetManagerCount", "()I",
(void*) android_content_AssetManager_getGlobalAssetCount },
};
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index aee0ed7..98fe0e6 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -251,10 +251,27 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
}
while ((de = readdir(d))) {
+ int t_pid;
+ int t_pri;
+
if (de->d_name[0] == '.')
continue;
+ t_pid = atoi(de->d_name);
+
+ if (!t_pid) {
+ LOGE("Error getting pid for '%s'\n", de->d_name);
+ continue;
+ }
- if (add_pid_to_cgroup(atoi(de->d_name), grp)) {
+ t_pri = getpriority(PRIO_PROCESS, t_pid);
+
+ if (grp == ANDROID_TGROUP_DEFAULT &&
+ t_pri >= ANDROID_PRIORITY_BACKGROUND) {
+ // This task wants to stay at background
+ continue;
+ }
+
+ if (add_pid_to_cgroup(t_pid, grp)) {
// If the thread exited on us, ignore it and keep going
if (errno != ESRCH && errno != ENOENT) {
signalExceptionForGroupError(env, clazz, errno);