diff options
Diffstat (limited to 'core/jni/AndroidRuntime.cpp')
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 87 |
1 files changed, 58 insertions, 29 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index e069876..f8e6bc3 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -29,7 +29,6 @@ #include <SkGraphics.h> #include <SkImageDecoder.h> -#include <SkImageRef_GlobalPool.h> #include "jni.h" #include "JNIHelp.h" @@ -83,6 +82,7 @@ extern int register_android_hardware_camera2_legacy_LegacyCameraDevice(JNIEnv *e extern int register_android_hardware_camera2_DngCreator(JNIEnv *env); extern int register_android_hardware_SensorManager(JNIEnv *env); extern int register_android_hardware_SerialPort(JNIEnv *env); +extern int register_android_hardware_SoundTrigger(JNIEnv *env); extern int register_android_hardware_UsbDevice(JNIEnv *env); extern int register_android_hardware_UsbDeviceConnection(JNIEnv *env); extern int register_android_hardware_UsbRequest(JNIEnv *env); @@ -130,7 +130,6 @@ extern int register_android_view_RenderNode(JNIEnv* env); extern int register_android_view_RenderNodeAnimator(JNIEnv* env); extern int register_android_view_GraphicBuffer(JNIEnv* env); extern int register_android_view_GLES20Canvas(JNIEnv* env); -extern int register_android_view_GLRenderer(JNIEnv* env); extern int register_android_view_HardwareLayer(JNIEnv* env); extern int register_android_view_ThreadedRenderer(JNIEnv* env); extern int register_android_view_Surface(JNIEnv* env); @@ -248,11 +247,6 @@ AndroidRuntime::AndroidRuntime(char* argBlockStart, const size_t argBlockLength) // this sets our preference for 16bit images during decode // in case the src is opaque and 24bit SkImageDecoder::SetDeviceConfig(SkBitmap::kRGB_565_Config); - // This cache is shared between browser native images, and java "purgeable" - // bitmaps. This globalpool is for images that do not either use the java - // heap, or are not backed by ashmem. See BitmapFactory.cpp for the key - // java call site. - SkImageRef_GlobalPool::SetRAMBudget(512 * 1024); // There is also a global font cache, but its budget is specified in code // see SkFontHost_android.cpp @@ -499,6 +493,8 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) char profile_duration[sizeof("-Xprofile-duration:") + PROPERTY_VALUE_MAX]; char profile_interval[sizeof("-Xprofile-interval:") + PROPERTY_VALUE_MAX]; char profile_backoff[sizeof("-Xprofile-backoff:") + PROPERTY_VALUE_MAX]; + char profile_top_k_threshold[sizeof("-Xprofile-top-k-threshold") + PROPERTY_VALUE_MAX]; + char profile_top_k_change_threshold[sizeof("-Xprofile-top-k-change-threshold") + PROPERTY_VALUE_MAX]; char langOption[sizeof("-Duser.language=") + 3]; char regionOption[sizeof("-Duser.region=") + 3]; char lockProfThresholdBuf[sizeof("-Xlockprofthreshold:") + sizeof(propBuf)]; @@ -822,31 +818,64 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) * Set profiler options */ if (libart) { - // Number of seconds during profile runs. - strcpy(profile_period, "-Xprofile-period:"); - property_get("dalvik.vm.profile.period_secs", profile_period+17, "10"); - opt.optionString = profile_period; - mOptions.add(opt); + // Whether or not the profiler should be enabled. + property_get("dalvik.vm.profiler", propBuf, "0"); + if (propBuf[0] == '1') { + opt.optionString = "-Xenable-profiler"; + mOptions.add(opt); + } - // Length of each profile run (seconds). - strcpy(profile_duration, "-Xprofile-duration:"); - property_get("dalvik.vm.profile.duration_secs", profile_duration+19, "30"); - opt.optionString = profile_duration; - mOptions.add(opt); + // Whether the profile should start upon app startup or be delayed by some random offset. + property_get("dalvik.vm.profile.start-immediately", propBuf, "0"); + if (propBuf[0] == '1') { + opt.optionString = "-Xprofile-start-immediately"; + mOptions.add(opt); + } + // Number of seconds during profile runs. + strcpy(profile_period, "-Xprofile-period:"); + if (property_get("dalvik.vm.profile.period-secs", profile_period+17, NULL) > 0) { + opt.optionString = profile_period; + mOptions.add(opt); + } - // Polling interval during profile run (microseconds). - strcpy(profile_interval, "-Xprofile-interval:"); - property_get("dalvik.vm.profile.interval_us", profile_interval+19, "10000"); - opt.optionString = profile_interval; - mOptions.add(opt); + // Length of each profile run (seconds). + strcpy(profile_duration, "-Xprofile-duration:"); + if (property_get("dalvik.vm.profile.duration-secs", profile_duration+19, NULL) > 0) { + opt.optionString = profile_duration; + mOptions.add(opt); + } - // Coefficient for period backoff. The the period is multiplied - // by this value after each profile run. - strcpy(profile_backoff, "-Xprofile-backoff:"); - property_get("dalvik.vm.profile.backoff_coeff", profile_backoff+18, "2.0"); - opt.optionString = profile_backoff; - mOptions.add(opt); + // Polling interval during profile run (microseconds). + strcpy(profile_interval, "-Xprofile-interval:"); + if (property_get("dalvik.vm.profile.interval-us", profile_interval+19, NULL) > 0) { + opt.optionString = profile_interval; + mOptions.add(opt); + } + + // Coefficient for period backoff. The the period is multiplied + // by this value after each profile run. + strcpy(profile_backoff, "-Xprofile-backoff:"); + if (property_get("dalvik.vm.profile.backoff-coeff", profile_backoff+18, NULL) > 0) { + opt.optionString = profile_backoff; + mOptions.add(opt); + } + + // Top K% of samples that are considered relevant when deciding if the app should be recompiled. + strcpy(profile_top_k_threshold, "-Xprofile-top-k-threshold:"); + if (property_get("dalvik.vm.profile.top-k-thr", profile_top_k_threshold+26, NULL) > 0) { + opt.optionString = profile_top_k_threshold; + mOptions.add(opt); + } + + // The threshold after which a change in the structure of the top K% profiled samples becomes significant + // and triggers recompilation. A change in profile is considered significant if X% (top-k-change-threshold) + // of the top K% (top-k-threshold property) samples has changed. + strcpy(profile_top_k_change_threshold, "-Xprofile-top-k-change-threshold:"); + if (property_get("dalvik.vm.profile.top-k-ch-thr", profile_top_k_change_threshold+33, NULL) > 0) { + opt.optionString = profile_top_k_change_threshold; + mOptions.add(opt); + } } initArgs.version = JNI_VERSION_1_4; @@ -1214,7 +1243,6 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_view_RenderNodeAnimator), REG_JNI(register_android_view_GraphicBuffer), REG_JNI(register_android_view_GLES20Canvas), - REG_JNI(register_android_view_GLRenderer), REG_JNI(register_android_view_HardwareLayer), REG_JNI(register_android_view_ThreadedRenderer), REG_JNI(register_android_view_Surface), @@ -1290,6 +1318,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_hardware_camera2_DngCreator), REG_JNI(register_android_hardware_SensorManager), REG_JNI(register_android_hardware_SerialPort), + REG_JNI(register_android_hardware_SoundTrigger), REG_JNI(register_android_hardware_UsbDevice), REG_JNI(register_android_hardware_UsbDeviceConnection), REG_JNI(register_android_hardware_UsbRequest), |