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

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

Merge "startop: Update app_startup_runner to toggle iorapd.readahead.enable"

parents a33ce8a3 995c17bd
Loading
Loading
Loading
Loading
+21 −1
Original line number Original line Diff line number Diff line
@@ -101,6 +101,15 @@ parse_arguments() {
    esac
    esac
    shift
    shift
  done
  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() {
echo_to_output_file() {
@@ -212,6 +221,12 @@ perform_aot() {
  local the_when="$1" # user: aot, jit
  local the_when="$1" # user: aot, jit
  local the_mode="$2" # warm, cold, fadvise, mlock, etc.
  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
  if [[ $the_when != "aot" ]]; then
    # TODO: just in time implementation.. should probably use system server.
    # TODO: just in time implementation.. should probably use system server.
    return 0
    return 0
@@ -250,13 +265,18 @@ perform_post_launch_cleanup() {
  local the_when="$1" # user: aot, jit
  local the_when="$1" # user: aot, jit
  local the_mode="$2" # warm, cold, fadvise, mlock, etc.
  local the_mode="$2" # warm, cold, fadvise, mlock, etc.
  local logcat_timestamp="$3"  # timestamp from before am start.
  local logcat_timestamp="$3"  # timestamp from before am start.
  local res


  if [[ $the_when != "aot" ]]; then
  if [[ $the_when != "aot" ]]; then
    if [[ $the_mode != 'warm' && $the_mode != 'cold' ]]; then
    if [[ $the_mode != 'warm' && $the_mode != 'cold' ]]; then
      # Validate that readahead completes.
      # Validate that readahead completes.
      # If this fails for some reason, then this will also discard the timing of the run.
      # 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"
      iorapd_readahead_wait_until_finished "$package" "$activity" "$logcat_timestamp" "$timeout"
      return $?
      res=$?

      iorapd_readahead_disable

      return $res
    fi
    fi
    # Don't need to do anything for warm or cold.
    # Don't need to do anything for warm or cold.
    return 0
    return 0
+1 −0
Original line number Original line Diff line number Diff line
@@ -322,6 +322,7 @@ collector_main() {
  iorapd_compiler_purge_trace_file "$package" "$activity" || return $?
  iorapd_compiler_purge_trace_file "$package" "$activity" || return $?


  iorapd_perfetto_enable || return $?
  iorapd_perfetto_enable || return $?
  iorapd_readahead_disable || return $?
  iorapd_start || return $?
  iorapd_start || return $?


  # Wait for perfetto trace to finished writing itself out.
  # Wait for perfetto trace to finished writing itself out.
+26 −1
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@ iorapd_perfetto_enable() {
  iorapd_reset # iorapd only reads this flag when initializing
  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.
# Subsequent launches of applications will no longer record perfetto trace protobufs.
iorapd_perfetto_disable() {
iorapd_perfetto_disable() {
  verbose_print 'disable perfetto'
  verbose_print 'disable perfetto'
@@ -53,6 +53,31 @@ iorapd_perfetto_disable() {
  iorapd_reset # iorapd only reads this flag when initializing
  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() {
_iorapd_path_to_data_file() {
  local package="$1"
  local package="$1"
  local activity="$2"
  local activity="$2"