| Index: tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py
|
| diff --git a/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py b/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py
|
| index 0e7cef57b2b51a6669c84ce983a011fb6f60b80c..fae8a47ff1605ba584fcc2252d63cd23dcbbd4be 100644
|
| --- a/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py
|
| +++ b/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py
|
| @@ -4,7 +4,6 @@
|
|
|
| import telemetry.core.platform.power_monitor as power_monitor
|
|
|
| -import logging
|
| import csv
|
|
|
| from collections import defaultdict
|
| @@ -59,11 +58,6 @@
|
| Returns:
|
| Dictionary in the format returned by StopMonitoringPower().
|
| """
|
| - # Raw power usage samples.
|
| - out_dict = {}
|
| - out_dict['identifier'] = 'dumpsys'
|
| - out_dict['power_samples_mw'] = []
|
| -
|
| # csv columns
|
| DUMP_VERSION_INDEX = 0
|
| COLUMN_TYPE_INDEX = 3
|
| @@ -79,10 +73,7 @@
|
| continue
|
| entries_by_type[entry[COLUMN_TYPE_INDEX]].append(entry)
|
| # Find the uid of for the given package.
|
| - if not package in entries_by_type:
|
| - logging.warning('Unable to parse dumpsys output. Please upgrade the OS.')
|
| - out_dict['energy_consumption_mwh'] = 0
|
| - return out_dict
|
| + assert package in entries_by_type, 'Expected package not found'
|
| assert len(entries_by_type[package]) == 1, 'Multiple entries for package.'
|
| uid = entries_by_type[package][0][PACKAGE_UID_INDEX]
|
| consumptions_mah = [float(entry[PWI_POWER_COMSUMPTION_INDEX])
|
| @@ -94,5 +85,9 @@
|
| # Converting at a nominal voltage of 4.0V, as those values are obtained by a
|
| # heuristic, and 4.0V is the voltage we set when using a monsoon device.
|
| consumption_mwh = consumption_mah * 4.0
|
| + # Raw power usage samples.
|
| + out_dict = {}
|
| + out_dict['identifier'] = 'dumpsys'
|
| + out_dict['power_samples_mw'] = []
|
| out_dict['energy_consumption_mwh'] = consumption_mwh
|
| return out_dict
|
|
|