diff options
author | Yan Wang <yawanng@google.com> | 2019-06-28 14:56:41 -0700 |
---|---|---|
committer | Yan Wang <yawanng@google.com> | 2019-07-10 16:20:51 -0700 |
commit | 90bc5ac1e03c4c99e417e65dca4bcfcd7374757a (patch) | |
tree | 4d31cf44c911142f9462504aab4aa1719ba1c21b /startop/scripts/app_startup | |
parent | 7cd8b3fd67ee0639cf801441e62bb6bb67d2052a (diff) |
startop: Update to toggle iorapd.readahead.enable.
Test: python run_app_with_prefetch.py -p com.android.settings -a com.android.settings.Settings -r fadvise -i input --debug --simulate
Test: python run_app_with_prefetch.py -p com.android.settings -a com.android.settings.Settings -r fadvise -i input
Test: pytest run_app_with_prefetch_test.py
Bug: 135286022
Change-Id: I4576ebb66bc41124e419681a296a47591f1f3d09
Diffstat (limited to 'startop/scripts/app_startup')
-rw-r--r-- | startop/scripts/app_startup/run_app_with_prefetch.py | 12 | ||||
-rw-r--r-- | startop/scripts/app_startup/run_app_with_prefetch_test.py | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/startop/scripts/app_startup/run_app_with_prefetch.py b/startop/scripts/app_startup/run_app_with_prefetch.py index c7970f5c4a67..41cbb2a5571c 100644 --- a/startop/scripts/app_startup/run_app_with_prefetch.py +++ b/startop/scripts/app_startup/run_app_with_prefetch.py @@ -228,6 +228,9 @@ def run(readahead: str, # Drop all caches to get cold starts. adb_utils.vm_drop_cache() + if readahead != 'warm' and readahead != 'cold': + iorapd_utils.enable_iorapd_readahead() + print_utils.debug_print('Running with timeout {}'.format(timeout)) pre_launch_timestamp = adb_utils.logcat_save_timestamp() @@ -272,12 +275,17 @@ def perform_post_launch_cleanup(readahead: str, A bool indicates whether the cleanup succeeds or not. """ if readahead != 'warm' and readahead != 'cold': - return iorapd_utils.wait_for_iorapd_finish(package, + passed = iorapd_utils.wait_for_iorapd_finish(package, activity, timeout, debug, logcat_timestamp) - return passed + + if not passed: + return passed + + return iorapd_utils.disable_iorapd_readahead() + # Don't need to do anything for warm or cold. return True diff --git a/startop/scripts/app_startup/run_app_with_prefetch_test.py b/startop/scripts/app_startup/run_app_with_prefetch_test.py index 241aea4943ef..32c39118eeed 100644 --- a/startop/scripts/app_startup/run_app_with_prefetch_test.py +++ b/startop/scripts/app_startup/run_app_with_prefetch_test.py @@ -243,6 +243,8 @@ def test_run_with_vm_cache_drop_and_post_launch_cleanup(): debug=False) calls = [call('adb shell "echo 3 > /proc/sys/vm/drop_caches"'), + call('bash -c "source {}; iorapd_readahead_enable"'. + format(run.IORAP_COMMON_BASH_SCRIPT)), call('adb shell "date -u +\'%Y-%m-%d %H:%M:%S.%N\'"'), call( 'timeout {timeout} "{DIR}/launch_application" "{package}" "{activity}" | ' @@ -262,6 +264,8 @@ def test_run_with_vm_cache_drop_and_post_launch_cleanup(): activity='MainActivity', timestamp='123:123', script_path=run.IORAP_COMMON_BASH_SCRIPT)), + call('bash -c "source {}; iorapd_readahead_disable"'. + format(run.IORAP_COMMON_BASH_SCRIPT)), call('adb shell ps | grep "music" | awk \'{print $2;}\''), call('adb shell "kill 9999"')] mock_run_shell_command.assert_has_calls(calls) |