anadroid.profiler package

Subpackages

Submodules

anadroid.profiler.AbstractProfiler module

class anadroid.profiler.AbstractProfiler.AbstractProfiler(profiler, device, pkg_name, device_dir=None, dependency=None, plugin=None)[source]

Bases: ABC

Defines a basic interface to be implemented by supported profilers. Provides a set of methods that allow to manage a profiling session lifecycle. .. attribute:: profiler

profiler.

type:

Profiler

device

target device.

Type:

Device

pkg_name

profiler package name.

Type:

str

device_dir

path of device directory where remote results can be stored.

Type:

str

dependency

dependencies to insert in apps to be profiled.

Type:

str

plugin

build plugins to insert in apps to be profiled.

Type:

str

abstract export_results(filename)[source]

export profiling session results.

abstract get_dependencies_location()[source]

return location of dependencies.

abstract init(**kwargs)[source]

method to setup profiler.

abstract needs_external_dependencies()[source]

checks if external dependencies are needed.

abstract start_profiling(tag='')[source]

method to start profiling session.

abstract stop_profiling(tag='')[source]

method to stop profiling session.

abstract update_state(tag='', desc='')[source]

log states/events during profiling session.

anadroid.profiler.GreenScalerProfiler module

class anadroid.profiler.GreenScalerProfiler.GREENSCALER_TASK(value)[source]

Bases: Enum

Enumerates tasks of greenscaler profiler

CPU_PROFILING = 'CPU Profiling'
SCREEN_CAPTURE = 'Screen Capture'
SYSTRACE = 'Syscal Tracing'
class anadroid.profiler.GreenScalerProfiler.GreenScalerProfiler(profiler, device, resources_dir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/profilers/GreenScaler')[source]

Bases: AbstractProfiler

Implements AbstractProfiler to allow profiling with GreenScalear profiler. Provides a set of methods that allow to manage a profiling session lifecycle. .. attribute:: resources_dir

directory with profiler resources.

type:

str

inner_app

the current app being tested.

Type:

GreenScalerApplication

exec_greenscaler(package, test_cmd, runs=1)[source]

Given the package name and the command to start the test, profile testing procedure with greenscaler. :param package: app package. :param test_cmd: test command to be called to exercise app. :param runs: number of executions.

export_results(out_filename=None)[source]

export profiling session results.

get_dependencies_location()[source]

return location of dependencies.

init(**kwargs)[source]

method to setup profiler.

install_profiler(install_script_name='push.sh')[source]

install profiler on device.

needs_external_dependencies()[source]

checks if external dependencies are needed.

pull_results(file_id, target_dir)[source]
start_profiling(task=GREENSCALER_TASK.CPU_PROFILING)[source]

method to start profiling session.

stop_profiling(tag='', export=False)[source]

method to stop profiling session.

update_state(val=0, desc='stopped')[source]

log states/events during profiling session.

anadroid.profiler.GreenScalerProfiler.exec_command(self, command)[source]

anadroid.profiler.ManafaProfiler module

class anadroid.profiler.ManafaProfiler.ManafaProfiler(profiler, device, power_profile=None, timezone=None, hunter=True)[source]

Bases: AbstractProfiler

Implements AbstractProfiler interface to allow profiling with Manafa profiler. Provides a set of methods that allow to manage a profiling session lifecycle. .. attribute:: manafa

EManafa profiler.

type:

EManafa

export_results(out_filename=None)[source]

does nothing.

get_dependencies_location()[source]

return location of dependencies.

init(**kwargs)[source]

method to setup profiler.

install_profiler()[source]
needs_external_dependencies()[source]

checks if external dependencies are needed.

pull_results(test_id, target_dir)[source]

pull results from device and put them in target_dir.

Pulls results from device, place them in target_dir and update tests index.

start_profiling(tag='')[source]

method to start profiling session.

stop_profiling(tag='', export=False)[source]

method to stop profiling session.

update_state(val=0, desc='stopped')[source]

does nothing.

anadroid.profiler.NoneProfiler module

class anadroid.profiler.NoneProfiler.NoneProfiler(profiler, device, power_profile=None, timezone=None, hunter=True)[source]

Bases: AbstractProfiler

Mock Profiler interaction.

export_results(out_filename=None)[source]

export profiling session results.

get_dependencies_location()[source]

return location of dependencies.

init(**kwargs)[source]

method to setup profiler.

install_profiler()[source]
needs_external_dependencies()[source]

checks if external dependencies are needed.

pull_results(file_id, target_dir)[source]
start_profiling(tag='')[source]

method to start profiling session.

stop_profiling(tag='', export=False)[source]

method to stop profiling session.

update_state(val=0, desc='stopped')[source]

log states/events during profiling session.

anadroid.profiler.TrepnProfiler module

class anadroid.profiler.TrepnProfiler.TrepnProfiler(profiler, device)[source]

Bases: AbstractProfiler

Implements AbstractProfiler interface to allow profiling with Trepn profiler and TrepnLib. Provides a set of methods that allow to manage a profiling session lifecycle. .. attribute:: local_dep_location

location of trepn apk.

type:

str

export_results(out_filename='trepnfile.csv')[source]

export results of the previous profiing session. :param out_filename: output filepath.

Returns:

output filepath.

Return type:

out_filename

get_dependencies_location()[source]

return location of dependencies.

get_last_run_duration()[source]
init(**kwargs)[source]

method to setup profiler.

install_profiler(apk_loc='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/profilers/Trepn/apks/com.quicinc.trepn-6.2-APK4Fun.com.apk')[source]

install trepn profiler on device. :param apk_loc: apk location.

load_preferences_file(pref_file=None)[source]

load trepn preferences file containing the list of resources to profile.

log_run_duration()[source]
needs_external_dependencies()[source]

checks if external dependencies are needed.

pull_results(file_id, target_dir)[source]

pull results from file

setup_device_dir()[source]
setup_trepn_device_dir()[source]

setup directory on device where results will be temporarly stored.

start_profiling(tag='')[source]

starts trepn service.

stop_profiling(tag='', export=False)[source]

stops trepn service.

update_state(val=0, desc='stopped')[source]

updates state of trepn using activity manager.

Module contents