diff options
author | Igor Murashkin <iam@google.com> | 2020-02-25 14:18:55 -0800 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2020-02-25 14:30:45 -0800 |
commit | 3fc5e2c322eeb04fd552979e6f355d2069606c23 (patch) | |
tree | f154f7e03fef56f880ee38cd40593c8e5d7c83b6 /startop/scripts | |
parent | cb2d2ec786140c9ff001868308d5ffb1c0456d2a (diff) |
startop: Fix scripts and add --reportfullydrawn
Fixes a bug in the scripts which prevented true cold starts from
happening (it was force-stopping the activity after the dropcaches).
Also adds -rfd/--reportfullydrawn to make rfd parsing optional since
most apps don't have it.
Bug: 150237362
Test: run_app_with_prefetch -r cold
Change-Id: I132bfc3ccd4d96f171ed364ef64387bbf2c78091
Diffstat (limited to 'startop/scripts')
-rwxr-xr-x | startop/scripts/app_startup/parse_metrics | 20 | ||||
-rwxr-xr-x | startop/scripts/app_startup/run_app_with_prefetch | 19 | ||||
-rwxr-xr-x[-rw-r--r--] | startop/scripts/app_startup/run_app_with_prefetch.py | 0 |
3 files changed, 33 insertions, 6 deletions
diff --git a/startop/scripts/app_startup/parse_metrics b/startop/scripts/app_startup/parse_metrics index 036609ff02be..3fa1462bc56e 100755 --- a/startop/scripts/app_startup/parse_metrics +++ b/startop/scripts/app_startup/parse_metrics @@ -42,12 +42,14 @@ Usage: launch_application package activity | parse_metrics --package <name> --ti -h, --help usage information (this) -v, --verbose enable extra verbose printing -t, --timeout <sec> how many seconds to timeout when trying to wait for logcat to change + -rfd, --reportfullydrawn wait for report fully drawn (default: off) EOF } DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "$DIR/lib/common" +report_fully_drawn="n" package="" activity="" timeout=5 @@ -81,6 +83,11 @@ parse_arguments() { -s|--simulate) simulate="y" ;; + -rfd|--reportfullydrawn) + report_fully_drawn="y" + ;; + + *) echo "Invalid argument: $1" >&2 exit 1 @@ -190,12 +197,15 @@ re_pattern='.*Displayed[[:blank:]]\+'"${package}"'[/][^[:blank:]]\+[[:blank:]]+\ parse_metric_from_logcat "Displayed_ms" "$pattern" "$re_pattern" -# 01-16 17:31:44.550 11172 11204 I ActivityTaskManager: Fully drawn com.google.android.GoogleCamera/com.android.camera.CameraLauncher: +10s897ms -pattern="ActivityTaskManager: Fully drawn ${package}" -#re_pattern='.*Fully drawn[[:blank:]]\+'"${package}"'[/][^[:blank:]]\+[[:blank:]]+\([[:digit:]]\+\).*' -re_pattern='.*Fully drawn[[:blank:]]\+'"${package}"'[/][^[:blank:]]\+[[:blank:]]+\([[:digit:]]\+ms\|[[:digit:]]\+s[[:digit:]]\+ms\).*' +# Only track ReportFullyDrawn with --reportfullydrawn/-rfd flags +if [[ $report_fully_drawn == y ]]; then + # 01-16 17:31:44.550 11172 11204 I ActivityTaskManager: Fully drawn com.google.android.GoogleCamera/com.android.camera.CameraLauncher: +10s897ms + pattern="ActivityTaskManager: Fully drawn ${package}" + #re_pattern='.*Fully drawn[[:blank:]]\+'"${package}"'[/][^[:blank:]]\+[[:blank:]]+\([[:digit:]]\+\).*' + re_pattern='.*Fully drawn[[:blank:]]\+'"${package}"'[/][^[:blank:]]\+[[:blank:]]+\([[:digit:]]\+ms\|[[:digit:]]\+s[[:digit:]]\+ms\).*' -parse_metric_from_logcat "Fully_drawn_ms" "$pattern" "$re_pattern" + parse_metric_from_logcat "Fully_drawn_ms" "$pattern" "$re_pattern" +fi # also call into package-specific scripts if there are additional metrics if [[ -x "$DIR/metrics/$package" ]]; then diff --git a/startop/scripts/app_startup/run_app_with_prefetch b/startop/scripts/app_startup/run_app_with_prefetch index 92a31c30a12d..31f625334b1e 100755 --- a/startop/scripts/app_startup/run_app_with_prefetch +++ b/startop/scripts/app_startup/run_app_with_prefetch @@ -35,6 +35,7 @@ EOF DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "$DIR/../iorap/common" +report_fully_drawn="n" needs_trace_file="n" input_file="" package="" @@ -70,6 +71,10 @@ parse_arguments() { mode="$2" shift ;; + -rfd|--reportfullydrawn) + report_fully_drawn="y" + shift + ;; -c|--count) count="$2" ((count+=1)) @@ -403,7 +408,11 @@ parse_metrics_header() { join_by ',' "${all_metrics[@]}" } -metrics_header="$("$DIR/parse_metrics" --package "$package" --activity "$activity" --simulate | parse_metrics_header)" +if [[ $report_fully_drawn == y ]]; then + metrics_header="$("$DIR/parse_metrics" --package "$package" --activity "$activity" --simulate --reportfullydrawn | parse_metrics_header)" +else + metrics_header="$("$DIR/parse_metrics" --package "$package" --activity "$activity" --simulate | parse_metrics_header)" +fi # TODO: This loop logic could probably be moved into app_startup_runner.py for ((i=0;i<count;++i)) do @@ -411,6 +420,9 @@ for ((i=0;i<count;++i)) do verbose_print "==== ITERATION $i ====" verbose_print "==========================================" if [[ $mode != "warm" ]]; then + # The package must be killed **before** we drop caches, otherwise pages will stay resident. + verbose_print "Kill package for non-warm start." + remote_pkill "$package" verbose_print "Drop caches for non-warm start." # Drop all caches to get cold starts. adb shell "echo 3 > /proc/sys/vm/drop_caches" @@ -423,7 +435,12 @@ for ((i=0;i<count;++i)) do pre_launch_timestamp="$(logcat_save_timestamp)" # TODO: multiple metrics output. + +if [[ $report_fully_drawn == y ]]; then + total_time="$(timeout $timeout "$DIR/launch_application" "$package" "$activity" | "$DIR/parse_metrics" --package "$package" --activity "$activity" --timestamp "$pre_launch_timestamp" --reportfullydrawn | parse_metrics_output)" +else total_time="$(timeout $timeout "$DIR/launch_application" "$package" "$activity" | "$DIR/parse_metrics" --package "$package" --activity "$activity" --timestamp "$pre_launch_timestamp" | parse_metrics_output)" +fi if [[ $? -ne 0 ]]; then echo "WARNING: Skip bad result, try iteration again." >&2 diff --git a/startop/scripts/app_startup/run_app_with_prefetch.py b/startop/scripts/app_startup/run_app_with_prefetch.py index 2f1eff2c41f6..2f1eff2c41f6 100644..100755 --- a/startop/scripts/app_startup/run_app_with_prefetch.py +++ b/startop/scripts/app_startup/run_app_with_prefetch.py |