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

1. Via python-pip

pip install manafa

1.1 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

2. From sources

2.1 Clone repo

$ git clone https://github.com/RRua/e-manafa.git

2.2 Replicate the environment

Install virtual virtualenv enviroment (via python-pip):

$ python -m pip install --user virtualenv

2.3 Replicate locally the dev virtualenv

$ virtualenv env/

2.4 Activate the virtual environment

$ source env/bin/activate

2.6 Install required packages

$ pip install -r requirements.txt

2.6 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

Usage

Command line

$ python emanafa.py [-p|--profile <prof>] 
            [-t|--timezone <tz>] 
            [-pft|--perfettofile <pf>] 
            [-bts|--batstatsfile <bf>] 

Source

m = EManafa()
m.init()
m.start()
do_work_to_profile() # replace by procedure to be measured 
b_file, p_file = m.stop()
m.parseResults(b_file, p_file)
begin = m.bat_events.events[0].time # first collected sample from batterystats
end = m.bat_events.events[-1].time # last collected sample from batterystats
global_consumption, per_component_consumption = m.getConsumptionInBetween(begin, end) # returns consumption between two instants of time between the profiling time
print(per_component_consumption)
print(global_consumption)

Supported devices:

This tool can be used with any Android device able to run Perfetto, 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

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.3.73.tar.gz (16.1 MB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: manafa-0.3.73.tar.gz
  • Upload date:
  • Size: 16.1 MB
  • 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.9.0

File hashes

Hashes for manafa-0.3.73.tar.gz
Algorithm Hash digest
SHA256 ff403e5a12e20b232bc1a90de019c7aa69211905f95ffd5f1ff682d0ec079843
MD5 e496d9926a5459f0ef7c71e9af24ed5b
BLAKE2b-256 c7029ef4e22d1294d434803bbab1c0ffff2c319f7f49312f373c23e656f83589

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