manafa.parsing.hunter package¶
Submodules¶
manafa.parsing.hunter.AppConsumptionStats module¶
- class manafa.parsing.hunter.AppConsumptionStats.AppConsumptionStats(results_dir='/Users/ruirua/repos/emanafa/manafa/results/consumptions')[source]¶
 Bases:
objectClass that stores method traces of apps registered with hunter.
This class parses and batterystats history events from files parsed using parseFile function. It starts by load information contained in the device power profile file and also the current state values known by the profiler, stored in definitions attribute.
- app_traces¶
 method traces.
- Type
 dict
- results_dir¶
 results’ directory.
- Type
 int
- get_output_filepath(test_id)[source]¶
 gets path of output file where the consumption info will be written. :returns: filepath :rtype: str
- save_function_info(filename, filter_zeros=False)[source]¶
 save method traces contained in app_traces to file. :param filename: name of output file. :param filter_zeros: filter zeros
- Returns
 path of the output file
- Return type
 str
- static write_consumptions(filename, consumption, function=None)[source]¶
 writes consumption info to file. :param filename: path of output file. :type filename: str :param consumption: consumption value. :type consumption: float :param function: option function name if the consumption is from a function.
manafa.parsing.hunter.HunterParser module¶
- class manafa.parsing.hunter.HunterParser.HunterParser(boot_time=0)[source]¶
 Bases:
objectClass that parses traces in log files generated by a custom hunter plugin.
This class parses method traces contained in log files generated by a custom hunter plugin.
- trace¶
 method traces.
- Type
 dict
- boot_time¶
 timestamp of the device’s last boot.
- Type
 float
- end_time¶
 timestamp of the last trace.
- Type
 float
- add_consumption(function_name, position, consumption, per_component_consumption, metrics)[source]¶
 updates consumption stats when a line referring a function is parsed. :param function_name: name of the function to update. :param position: index in stats. equivalent to number of function calls so far. :param consumption: consumption value. :param per_component_consumption: consumption per component. :param metrics: batterystats during function execution.
- parse_file(filepath, functions, instrument=False)[source]¶
 function to parse traces from filepath file. :param filepath: logfile with app traces. :param functions: list of function names to filter. :param instrument: optional paramm to enable or disable function filtering.
- parse_history(lines_list, functions, instrument=False, start_time=0, end_time=9223372036854775807)[source]¶
 function to parse app traces from a list of lines (lines_list). :param lines_list: list of lines from log file. :param functions: list of function names to filter. :param instrument: optional paramm to enable or disable function filtering. :param start_time: lower timestamp bound. :param end_time: upper timestmp bound.
- return_cpu_consumption_and_time_by_function(function_name, checked)[source]¶
 returns energy consumed and elapsed time of function with function_name- :param function_name: name of the function. :param checked: if the start and end time of the function was determined.
- Returns
 da_time:
- Return type
 cpu_consumption