Merge "startop: Fix scripts and add --reportfullydrawn" into rvc-dev am: 2f6d575468 am: f2d8b82254

Change-Id: I67a6fb8b1573d727b95dbef83058d350af9396c1
This commit is contained in:
Automerger Merge Worker
2020-02-26 19:12:31 +00:00
3 changed files with 33 additions and 6 deletions

View File

@@ -42,12 +42,14 @@ Usage: launch_application package activity | parse_metrics --package <name> --ti
-h, --help usage information (this) -h, --help usage information (this)
-v, --verbose enable extra verbose printing -v, --verbose enable extra verbose printing
-t, --timeout <sec> how many seconds to timeout when trying to wait for logcat to change -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 EOF
} }
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$DIR/lib/common" source "$DIR/lib/common"
report_fully_drawn="n"
package="" package=""
activity="" activity=""
timeout=5 timeout=5
@@ -81,6 +83,11 @@ parse_arguments() {
-s|--simulate) -s|--simulate)
simulate="y" simulate="y"
;; ;;
-rfd|--reportfullydrawn)
report_fully_drawn="y"
;;
*) *)
echo "Invalid argument: $1" >&2 echo "Invalid argument: $1" >&2
exit 1 exit 1
@@ -190,12 +197,15 @@ re_pattern='.*Displayed[[:blank:]]\+'"${package}"'[/][^[:blank:]]\+[[:blank:]]+\
parse_metric_from_logcat "Displayed_ms" "$pattern" "$re_pattern" 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 # Only track ReportFullyDrawn with --reportfullydrawn/-rfd flags
pattern="ActivityTaskManager: Fully drawn ${package}" if [[ $report_fully_drawn == y ]]; then
#re_pattern='.*Fully drawn[[:blank:]]\+'"${package}"'[/][^[:blank:]]\+[[:blank:]]+\([[:digit:]]\+\).*' # 01-16 17:31:44.550 11172 11204 I ActivityTaskManager: Fully drawn com.google.android.GoogleCamera/com.android.camera.CameraLauncher: +10s897ms
re_pattern='.*Fully drawn[[:blank:]]\+'"${package}"'[/][^[:blank:]]\+[[:blank:]]+\([[:digit:]]\+ms\|[[:digit:]]\+s[[:digit:]]\+ms\).*' 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 # also call into package-specific scripts if there are additional metrics
if [[ -x "$DIR/metrics/$package" ]]; then if [[ -x "$DIR/metrics/$package" ]]; then

View File

@@ -35,6 +35,7 @@ EOF
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$DIR/../iorap/common" source "$DIR/../iorap/common"
report_fully_drawn="n"
needs_trace_file="n" needs_trace_file="n"
input_file="" input_file=""
package="" package=""
@@ -70,6 +71,10 @@ parse_arguments() {
mode="$2" mode="$2"
shift shift
;; ;;
-rfd|--reportfullydrawn)
report_fully_drawn="y"
shift
;;
-c|--count) -c|--count)
count="$2" count="$2"
((count+=1)) ((count+=1))
@@ -403,7 +408,11 @@ parse_metrics_header() {
join_by ',' "${all_metrics[@]}" 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 # TODO: This loop logic could probably be moved into app_startup_runner.py
for ((i=0;i<count;++i)) do for ((i=0;i<count;++i)) do
@@ -411,6 +420,9 @@ for ((i=0;i<count;++i)) do
verbose_print "==== ITERATION $i ====" verbose_print "==== ITERATION $i ===="
verbose_print "==========================================" verbose_print "=========================================="
if [[ $mode != "warm" ]]; then 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." verbose_print "Drop caches for non-warm start."
# Drop all caches to get cold starts. # Drop all caches to get cold starts.
adb shell "echo 3 > /proc/sys/vm/drop_caches" 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)" pre_launch_timestamp="$(logcat_save_timestamp)"
# TODO: multiple metrics output. # 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)" 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 if [[ $? -ne 0 ]]; then
echo "WARNING: Skip bad result, try iteration again." >&2 echo "WARNING: Skip bad result, try iteration again." >&2

0
startop/scripts/app_startup/run_app_with_prefetch.py Normal file → Executable file
View File