Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f6d5754 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "startop: Fix scripts and add --reportfullydrawn" into rvc-dev

parents 2f9694c6 3fc5e2c3
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -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"

# 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"
fi

# also call into package-specific scripts if there are additional metrics
if [[ -x "$DIR/metrics/$package" ]]; then
+18 −1
Original line number Diff line number Diff line
@@ -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[@]}"
}

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
+0 −0

File mode changed from 100644 to 100755.