Skip to main content

E-MANAFA: Energy Monitor and ANAlyzer For Android

Project description

Build Status made-with-python PyPI version PyPI license PyPI status

E-MANAFA: Energy Monitor and ANAlyzer For Android

E-MANAFA is a software model-based tool for performing fine-grained estimates of energy consumption on Android devices. For this purpose, it uses values from power_profile.xml and from the BatteryStats and Perfetto services to estimate the energy consumption of each resource / component of the device.

SETUP

In order to run this tool, the following resources are required:

Installation

pip install manafa

define environment variables

In order to run this tool, there are at least 2 env. variables that need to be defined in the shell startup script (e.g .bashrc or .bash_profile file)

export ANDROID_HOME=$HOME/<your-android-instalation-folder>/ 
export PATH=$ANDROID_HOME/platform-tools:$PATH

Replicate the environment

Install virtual virtualenv enviroment (via python-pip):

$ python -m pip install --user virtualenv

Replicate locally the dev virtualenv

$ virtualenv env/

Activate the virtual environment

$ source env/bin/activate

Extract power_profile.xml file from device (https://source.android.com/devices/tech/power/values)

Note: This file present in every device since Android 5 should contain values that were estimated by device manufacturers using external apparatus. However, most devices don't provide a fine-grained power profile. Google provides a set of instructions in order to complete this file with more accurate values(https://source.android.com/devices/tech/power/component).

TODO

Install required packages

$ pip install -r requirements.txt

Examples

# getting the energy consumed during a profiling session (between first and last measurement)
g = GreenStats(power_profile=DEFAULT_PROFILE, timezone="EST")
g.init()
g.start()
do_some_work()
batstats_out_file, perfetto_out_file = g.stop()
g.parseResults( DEFAULT_PROFILE, batstats_out_file , perfetto_out_file )
begin = g.bat_events.events[0].time
end = g.bat_events.events[-1].time
consumption,per_component_consumption = g.getConsumptionInBetween(begin, end)
print("Energy consumed: %f Joules" % consumption)

Supported devices:

This tool can be used with any Android device able to run Perfetto, that is available since Android 9 (P). The tool so far was successfuly executed on the following devices:

  • Pixel 3a
  • Pixel 4a 5G
  • Xiaomi Mi 9 Lite

TODO

  • calibrate the model
  • test using flashlight
  • wifi pixel4a

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manafa-0.2.97.tar.gz (27.4 kB view details)

Uploaded Source

File details

Details for the file manafa-0.2.97.tar.gz.

File metadata

  • Download URL: manafa-0.2.97.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for manafa-0.2.97.tar.gz
Algorithm Hash digest
SHA256 3352ac93350fd6a52c367cb652ef20246a196323f5958285bc358e896021560c
MD5 5f9a4768b68cb10cb029d98aefe3eccd
BLAKE2b-256 21375a4a3ad124edde8a8104765950fa293fe3dbc143fd7e776a103003cc9c10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page