Loading core/java/android/os/Debug.java +4 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.internal.util.FastPrintWriter; import com.android.internal.util.Preconditions; import com.android.internal.util.TypedProperties; import dalvik.annotation.optimization.CriticalNative; import dalvik.system.VMDebug; import org.apache.harmony.dalvik.ddmc.Chunk; Loading Loading @@ -1936,18 +1937,21 @@ public final class Debug * Returns the size of the native heap. * @return The size of the native heap in bytes. */ @CriticalNative public static native long getNativeHeapSize(); /** * Returns the amount of allocated memory in the native heap. * @return The allocated size in bytes. */ @CriticalNative public static native long getNativeHeapAllocatedSize(); /** * Returns the amount of free memory in the native heap. * @return The freed size in bytes. */ @CriticalNative public static native long getNativeHeapFreeSize(); /** Loading core/jni/android_os_Debug.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -51,10 +51,12 @@ #include <utils/misc.h> #include <vintf/KernelConfigs.h> #include <iomanip> #include <string> #include <vector> #include "core_jni_helpers.h" #include "jni.h" namespace android Loading Loading @@ -102,19 +104,19 @@ static jfieldID hasSwappedOutPss_field; #define BINDER_STATS "/proc/binder/stats" static jlong android_os_Debug_getNativeHeapSize(JNIEnv *env, jobject clazz) static jlong android_os_Debug_getNativeHeapSize(CRITICAL_JNI_PARAMS) { struct mallinfo info = mallinfo(); return (jlong) info.usmblks; } static jlong android_os_Debug_getNativeHeapAllocatedSize(JNIEnv *env, jobject clazz) static jlong android_os_Debug_getNativeHeapAllocatedSize(CRITICAL_JNI_PARAMS) { struct mallinfo info = mallinfo(); return (jlong) info.uordblks; } static jlong android_os_Debug_getNativeHeapFreeSize(JNIEnv *env, jobject clazz) static jlong android_os_Debug_getNativeHeapFreeSize(CRITICAL_JNI_PARAMS) { struct mallinfo info = mallinfo(); return (jlong) info.fordblks; Loading Loading
core/java/android/os/Debug.java +4 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.internal.util.FastPrintWriter; import com.android.internal.util.Preconditions; import com.android.internal.util.TypedProperties; import dalvik.annotation.optimization.CriticalNative; import dalvik.system.VMDebug; import org.apache.harmony.dalvik.ddmc.Chunk; Loading Loading @@ -1936,18 +1937,21 @@ public final class Debug * Returns the size of the native heap. * @return The size of the native heap in bytes. */ @CriticalNative public static native long getNativeHeapSize(); /** * Returns the amount of allocated memory in the native heap. * @return The allocated size in bytes. */ @CriticalNative public static native long getNativeHeapAllocatedSize(); /** * Returns the amount of free memory in the native heap. * @return The freed size in bytes. */ @CriticalNative public static native long getNativeHeapFreeSize(); /** Loading
core/jni/android_os_Debug.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -51,10 +51,12 @@ #include <utils/misc.h> #include <vintf/KernelConfigs.h> #include <iomanip> #include <string> #include <vector> #include "core_jni_helpers.h" #include "jni.h" namespace android Loading Loading @@ -102,19 +104,19 @@ static jfieldID hasSwappedOutPss_field; #define BINDER_STATS "/proc/binder/stats" static jlong android_os_Debug_getNativeHeapSize(JNIEnv *env, jobject clazz) static jlong android_os_Debug_getNativeHeapSize(CRITICAL_JNI_PARAMS) { struct mallinfo info = mallinfo(); return (jlong) info.usmblks; } static jlong android_os_Debug_getNativeHeapAllocatedSize(JNIEnv *env, jobject clazz) static jlong android_os_Debug_getNativeHeapAllocatedSize(CRITICAL_JNI_PARAMS) { struct mallinfo info = mallinfo(); return (jlong) info.uordblks; } static jlong android_os_Debug_getNativeHeapFreeSize(JNIEnv *env, jobject clazz) static jlong android_os_Debug_getNativeHeapFreeSize(CRITICAL_JNI_PARAMS) { struct mallinfo info = mallinfo(); return (jlong) info.fordblks; Loading