summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2014-06-02 16:45:13 +0100
committerCalin Juravle <calin@google.com>2014-06-06 12:55:23 +0100
commit9828d067fb877d8c78b5b5f2f7c0a08649e50f59 (patch)
treee9567a07828453d3c390988116fd3a2932dd4059
parentb2842e72819b3eb724503290e9eaa7c50f65e45b (diff)
downloadbase-9828d067fb877d8c78b5b5f2f7c0a08649e50f59.tar.gz
Add missing profiler options.
Bug: 12877748 Change-Id: I311b8fb7e15d512e65631bc2a52c443a271d3d3f
-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 78885d24db7c..17725096058d 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -488,6 +488,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)];
@@ -811,31 +813,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;