diff options
author | Igor Murashkin <iam@google.com> | 2019-06-10 16:35:17 -0700 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2019-06-13 16:42:26 -0700 |
commit | 995c17bdd0e3eba0fca7fce4ad527adb4c16cd50 (patch) | |
tree | 17a94d2c9b4bea031dbdd1216a69d7163b1007b7 /startop/scripts | |
parent | 77babbe3dc067872e5725de1a8031a73dfd8a61c (diff) |
startop: Update app_startup_runner to toggle iorapd.readahead.enable
Bug: 134784018
Change-Id: I6a43696cbdc91542fe3683071850192dfc22b759
Test: manual (run with and without fadvise mode)
Diffstat (limited to 'startop/scripts')
-rwxr-xr-x | startop/scripts/app_startup/run_app_with_prefetch | 22 | ||||
-rwxr-xr-x | startop/scripts/iorap/collector | 1 | ||||
-rwxr-xr-x | startop/scripts/iorap/common | 27 |
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 c10327ef09c1..65ce47a8be23 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" |