From 27196ebc8d8d0cd8279755b6eca587f2f8ac6d4b Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Wed, 23 Jan 2013 15:19:11 -0800 Subject: GC triggering performance optimizations Copy the correct starting heap size at process init. Interfaces to set GC/managed heap parameters. Change-Id: If0b1637291e77f9781ae6249c5d0257f659253ca --- dalvik/src/main/java/dalvik/system/VMRuntime.java | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dalvik/src/main/java/dalvik/system/VMRuntime.java b/dalvik/src/main/java/dalvik/system/VMRuntime.java index 71098be..239a876 100644 --- a/dalvik/src/main/java/dalvik/system/VMRuntime.java +++ b/dalvik/src/main/java/dalvik/system/VMRuntime.java @@ -107,6 +107,31 @@ public final class VMRuntime { } /** + * @hide + */ + public float setTargetHeapMinFree(int size) { + /* Synchronize to make sure that only one thread gets + * a given "old" value if both update at the same time. + * Allows for reliable save-and-restore semantics. + */ + synchronized (this) { + return nativeSetTargetHeapMinFree(size); + } + } + /** + * @hide + */ + public float setTargetHeapConcurrentStart(int size) { + /* Synchronize to make sure that only one thread gets + * a given "old" value if both update at the same time. + * Allows for reliable save-and-restore semantics. + */ + synchronized (this) { + return nativeSetTargetHeapConcurrentStart(size); + } + } + + /** * Sets the target SDK version. Should only be called before the * app starts to run, because it may change the VM's behavior in * dangerous ways. Use 0 to mean "current" (since callers won't @@ -156,6 +181,12 @@ public final class VMRuntime { * This value may be adjusted internally. */ private native void nativeSetTargetHeapUtilization(float newTarget); + /* @hide + */ + private native int nativeSetTargetHeapMinFree(int size); + /* @hide + */ + private native int nativeSetTargetHeapConcurrentStart(int size); /** * This method exists for binary compatibility. It was part of -- cgit v1.1