summaryrefslogtreecommitdiffstats
path: root/core/jni/AndroidRuntime.cpp
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2014-06-06 12:31:24 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-06 12:31:24 +0000
commitc09722dc554a27b472c6f6264f9479d6d0639a28 (patch)
tree7a08a75bc59fc27e21f32406bcf6af6544df73a6 /core/jni/AndroidRuntime.cpp
parenta61fbbd0c3d58ab1c801df2ec050b9a76fc10fbf (diff)
parentc88a5ac3ff0e3b3759c58279204bb8f6b8901669 (diff)
downloadframeworks_base-c09722dc554a27b472c6f6264f9479d6d0639a28.zip
frameworks_base-c09722dc554a27b472c6f6264f9479d6d0639a28.tar.gz
frameworks_base-c09722dc554a27b472c6f6264f9479d6d0639a28.tar.bz2
am c88a5ac3: am d1d46d9d: am bbf849b1: Merge "Add missing profiler options."
* commit 'c88a5ac3ff0e3b3759c58279204bb8f6b8901669': Add missing profiler options.
Diffstat (limited to 'core/jni/AndroidRuntime.cpp')
-rw-r--r--core/jni/AndroidRuntime.cpp76
1 files changed, 55 insertions, 21 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 4f2028e..9383f4e 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -493,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)];
@@ -816,31 +818,63 @@ 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);
+ // Number of seconds during profile runs.
+ 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);
+ 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;