manafa.services package

Submodules

manafa.services.LogService module

class manafa.services.LogService.LogService(boot_time=0, output_res_folder='hunter')[source]

Bases: manafa.services.service.Service

Class that manages the device’s log.

This class is responsible by cleaning the log before each execution of the framework, as well as dump the log

right after each execution.

boot_time

timestamp of the device’s last boot.

Type

float

output_res_folder

folder where the logs will be stored after each profiling session.

Type

float

clean()[source]

cleans device log state and removes files from previous runs.

config(**kwargs)[source]
get_results_filename(run_id)[source]

returns the name of the output file. :returns: the name of the output file. :rtype: output_name

init(boot_time=0, **kwargs)[source]

inits the class. :param boot_time: device boot timestamp. :param **kwargs:

start(run_id=None)[source]

starts the profiling session.

Calls clean() to discard logs prior to the start of the session. :param run_id: current session/run id. Considered only for API compat purposes. :type run_id: str

stop(run_id=None)[source]

stops the profiling session.

Dump the logs in output file. :returns: the name of the output file. :rtype: filename

manafa.services.batteryStatsService module

class manafa.services.batteryStatsService.BatteryStatsService(boot_time=0, output_res_folder='batterystats')[source]

Bases: manafa.services.service.Service

Class that manages the battery stats service state.

This class is responsible by cleaning the service state before each execution of the framework, as well as record its state right after each execution.

boot_time

timestamp of the device’s last boot.

Type

float

output_res_folder

folder where the logs will be stored after each profiling session.

Type

float

clean()[source]

cleans data from previous run(s).

config(**kwargs)[source]

Does the same as Zaidu when Conceicao asks him to cross.

init(boot_time=0, **kwargs)[source]

inits the service. :param boot_time: :param **kwargs:

start()[source]

starts the service.

Resets the service state in order to forget previous recorded information. this helps to save storage and time by discarding events prior to the start of the profiling session.

stop(run_id=None)[source]

stops the service.

To be called when the profiling session is over. Saves the recorded events in results_dir folder. :param run_id: current session id. :type run_id: str

manafa.services.perfettoService module

class manafa.services.perfettoService.PerfettoService(boot_time=0, output_res_folder='perfetto', default_out_dir='/data/misc/perfetto-traces', cfg_file='perfetto.config.bin')[source]

Bases: manafa.services.service.Service

Class that manages the perfetto service.

This class is responsible by starting and stopping the perfetto service at the start and stop of the profiiling session. .. attribute:: boot_time

timestamp of the device’s last boot.

type

float

output_res_folder

folder where the logs will be stored after each profiling session.

Type

str

default_out_dir

device default results dir.

Type

str

cfg_file

perfetto config file.

Type

str

clean()[source]

wipes results from previous runs.

config(**kwargs)[source]
export()[source]

Exports results from previous runs. last_exported: path of last exported file.

get_run_id_from_perfetto_file(perfetto_filepath: str)[source]

returns profiling session id given its filepath

init(boot_time=0, **kwargs)[source]

inits the service. Resets boot time and cleans files from previous runs. :param boot_time: timestamp of the device’s last boot. :param **kwargs:

start()[source]

start profiling session.

Starts perfetto service, using the config file cfg_file as input.

stop(file_id)[source]

Stops the profiling session and exports results.

Stops the perfetto service and pulls the results from device. Afterwards, it exports the pulled results using traceconv, returning the path to the last exported file as result. :param file_id: run id.

Returns

path of last exported file.

Return type

last_exported

manafa.services.service module

class manafa.services.service.Service(results_dir='')[source]

Bases: abc.ABC

Reference class for managing the lifecycle of a task need during the profiling session.

This class is responsible by starting and stopping the perfetto service at the start and stop of the profiiling session.

results_dir

folder where the logs will be stored after each profiling session.

Type

str

clean()[source]

wipes results from previous runs.

abstract config(**kwargs)[source]
save_results(output_dir='')[source]
abstract start()[source]
abstract stop(run_id)[source]

Module contents

A one line summary of the module or program, terminated by a period.

Leave one blank line. The rest of this docstring should contain an overall description of the module or program. Optionally, it may also contain a brief description of exported classes and functions and/or usage examples.