summaryrefslogtreecommitdiff
path: root/startop/scripts
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-06-26 00:29:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-06-26 00:29:10 +0000
commitb24a3b1b33217472b8c5d62927dbfb76f3f84b29 (patch)
tree9d7fe0fa13e0f1e5c1580391b89be71963abf6b2 /startop/scripts
parenta33ce8a337a7ec6d05b92fcd49e8eec9241e178e (diff)
parent995c17bdd0e3eba0fca7fce4ad527adb4c16cd50 (diff)
Merge "startop: Update app_startup_runner to toggle iorapd.readahead.enable"
Diffstat (limited to 'startop/scripts')
-rwxr-xr-xstartop/scripts/app_startup/run_app_with_prefetch22
-rwxr-xr-xstartop/scripts/iorap/collector1
-rwxr-xr-xstartop/scripts/iorap/common27
3 files changed, 48 insertions, 2 deletions
diff --git a/startop/scripts/app_startup/run_app_with_prefetch b/startop/scripts/app_startup/run_app_with_prefetch
index 643df1ba0825..92a31c30a12d 100755
--- a/startop/scripts/app_startup/run_app_with_prefetch
+++ b/startop/scripts/app_startup/run_app_with_prefetch
@@ -101,6 +101,15 @@ parse_arguments() {
esac
shift
done
+
+ if [[ $when == "aot" ]]; then
+ # TODO: re-implement aot later for experimenting.
+ echo "Error: --when $when is unsupported" >&2
+ exit 1
+ elif [[ $when != "jit" ]]; then
+ echo "Error: --when must be one of (aot jit)." >&2
+ exit 1
+ fi
}
echo_to_output_file() {
@@ -212,6 +221,12 @@ perform_aot() {
local the_when="$1" # user: aot, jit
local the_mode="$2" # warm, cold, fadvise, mlock, etc.
+ # iorapd readahead for jit+(mlock/fadvise)
+ if [[ $the_when == "jit" && $the_mode != 'warm' && $the_mode != 'cold' ]]; then
+ iorapd_readahead_enable
+ return 0
+ fi
+
if [[ $the_when != "aot" ]]; then
# TODO: just in time implementation.. should probably use system server.
return 0
@@ -250,13 +265,18 @@ perform_post_launch_cleanup() {
local the_when="$1" # user: aot, jit
local the_mode="$2" # warm, cold, fadvise, mlock, etc.
local logcat_timestamp="$3" # timestamp from before am start.
+ local res
if [[ $the_when != "aot" ]]; then
if [[ $the_mode != 'warm' && $the_mode != 'cold' ]]; then
# Validate that readahead completes.
# If this fails for some reason, then this will also discard the timing of the run.
iorapd_readahead_wait_until_finished "$package" "$activity" "$logcat_timestamp" "$timeout"
- return $?
+ res=$?
+
+ iorapd_readahead_disable
+
+ return $res
fi
# Don't need to do anything for warm or cold.
return 0
diff --git a/startop/scripts/iorap/collector b/startop/scripts/iorap/collector
index d96125f76a37..3dc080a5ac9c 100755
--- a/startop/scripts/iorap/collector
+++ b/startop/scripts/iorap/collector
@@ -322,6 +322,7 @@ collector_main() {
iorapd_compiler_purge_trace_file "$package" "$activity" || return $?
iorapd_perfetto_enable || return $?
+ iorapd_readahead_disable || return $?
iorapd_start || return $?
# Wait for perfetto trace to finished writing itself out.
diff --git a/startop/scripts/iorap/common b/startop/scripts/iorap/common
index cb2b618fdad1..031dabfadeab 100755
--- a/startop/scripts/iorap/common
+++ b/startop/scripts/iorap/common
@@ -45,7 +45,7 @@ iorapd_perfetto_enable() {
iorapd_reset # iorapd only reads this flag when initializing
}
-# Enable perfetto tracing.
+# Disable perfetto tracing.
# Subsequent launches of applications will no longer record perfetto trace protobufs.
iorapd_perfetto_disable() {
verbose_print 'disable perfetto'
@@ -53,6 +53,31 @@ iorapd_perfetto_disable() {
iorapd_reset # iorapd only reads this flag when initializing
}
+# Enable readahead
+# Subsequent launches of an application will be sped up by iorapd readahead prefetching
+# (Provided an appropriate compiled trace exists for that application)
+iorapd_readahead_enable() {
+ if [[ "$(adb shell getprop iorapd.readahead.enable)" == true ]]; then
+ verbose_print 'enable readahead [already enabled]'
+ return 0
+ fi
+ verbose_print 'enable readahead [reset iorapd]'
+ adb shell setprop iorapd.readahead.enable true
+ iorapd_reset # iorapd only reads this flag when initializing
+}
+
+# Disable readahead
+# Subsequent launches of an application will be not be sped up by iorapd readahead prefetching.
+iorapd_readahead_disable() {
+ if [[ "$(adb shell getprop iorapd.readahead.enable)" == false ]]; then
+ verbose_print 'disable readahead [already disabled]'
+ return 0
+ fi
+ verbose_print 'disable readahead [reset iorapd]'
+ adb shell setprop iorapd.readahead.enable false
+ iorapd_reset # iorapd only reads this flag when initializing
+}
+
_iorapd_path_to_data_file() {
local package="$1"
local activity="$2"