Ejemplo n.º 1
0
def compile_perfetto_trace_on_device(package: str, activity: str,
                                     inodes: str) -> bool:
    """Compiles the perfetto trace using on-device compiler."""
    passed, _ = cmd_utils.run_shell_func(IORAP_COMMON_BASH_SCRIPT,
                                         'iorapd_compiler_for_app_trace',
                                         [package, activity, inodes])
    return passed
Ejemplo n.º 2
0
    def get_activity(package: str) -> str:
        """ Tries to set the activity based on the package. """
        passed, activity = cmd_utils.run_shell_func(
            AppRunner.IORAP_COMMON_BASH_SCRIPT, 'get_activity_name', [package])

        if not passed or not activity:
            raise ValueError(
                'Activity name could not be found, invalid package name?!')

        return activity
Ejemplo n.º 3
0
def stop_iorapd() -> bool:
    """
  Stops iorapd.

  Returns:
    A bool indicates whether the stopping is done successfully or not.
  """
    passed, _ = cmd_utils.run_shell_func(IORAP_COMMON_BASH_SCRIPT,
                                         'iorapd_stop', [])
    return passed
Ejemplo n.º 4
0
def disable_iorapd_perfetto() -> bool:
    """
  Disable Perfetto. Subsequent launches of applications will no longer record
  perfetto trace protobufs.

  Returns:
    A bool indicates whether the disabling is done successfully or not.
  """
    passed, _ = cmd_utils.run_shell_func(IORAP_COMMON_BASH_SCRIPT,
                                         'iorapd_perfetto_disable', [])
    return passed
Ejemplo n.º 5
0
def enable_iorapd_perfetto() -> bool:
    """
  Enable Perfetto. Subsequent launches of an application will record a perfetto
  trace protobuf.

  Returns:
    A bool indicates whether the enabling is done successfully or not.
  """
    passed, _ = cmd_utils.run_shell_func(IORAP_COMMON_BASH_SCRIPT,
                                         'iorapd_perfetto_enable', [])
    return passed
Ejemplo n.º 6
0
def disable_iorapd_readahead() -> bool:
    """
  Disable readahead. Subsequent launches of an application will be not be sped
  up by iorapd readahead prefetching.

  Returns:
    A bool indicates whether the disabling is done successfully or not.
  """
    passed, _ = cmd_utils.run_shell_func(IORAP_COMMON_BASH_SCRIPT,
                                         'iorapd_readahead_disable', [])
    return passed
Ejemplo n.º 7
0
def wait_for_iorapd_finish(package: str, activity: str, timeout: int,
                           debug: bool, logcat_timestamp: str) -> bool:
    """Waits for the finish of iorapd.

  Returns:
    A bool indicates whether the iorapd is done successfully or not.
  """
    # Set verbose for bash script based on debug flag.
    if debug:
        os.putenv('verbose', 'y')

    # Validate that readahead completes.
    # If this fails for some reason, then this will also discard the timing of
    # the run.
    passed, _ = cmd_utils.run_shell_func(
        IORAP_COMMON_BASH_SCRIPT, 'iorapd_readahead_wait_until_finished',
        [package, activity, logcat_timestamp,
         str(timeout)])
    return passed