manafa


Namemanafa JSON
Version 0.3.132 PyPI version JSON
download
home_pagehttps://github.com/RRua/e-manafa
SummaryE-MANAFA: Energy Monitor and ANAlyzer For Android
upload_time2023-08-21 16:15:30
maintainer
docs_urlNone
authorRui Rua
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.com/RRua/e-manafa.svg?branch=main)](https://travis-ci.com/RRua/e-manafa)
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
[![PyPI version](https://badge.fury.io/py/manafa.svg)](https://badge.fury.io/py/manafa)
[![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/manafa)
[![PyPI status](https://img.shields.io/pypi/status/ansicolortags.svg)](https://pypi.python.org/pypi/manafa)
[![DOI](https://zenodo.org/badge/459943164.svg)](https://zenodo.org/badge/latestdoi/459943164)


# E-MANAFA: Energy Monitor and ANAlyzer For Android

E-MANAFA is a plug-and-play software model-based tool for performing fine-grained estimates of energy consumption on Android devices. E-Manafa estimates system-level  and per-component energy consumption, by extracting information from the following sources:

- power_profile.xml: Device-specific file provided by manufacturers containing current consumption per component state;
- batterystats: Tool from Android framework that logs each power-related event that occurs between device charges;
- Perfetto: System-wide profiling for Linux and Android, that profiles high-frequency data, such as CPU frequency.

Note: Manufacturers not always supply information about the current consumed by an individual component in the power profile file. Use this information if it accurately represents the current drawn from the device battery in practice. The file can also be derived using external apparatus such as Monsoon. Google provides a set of guidelines to estimating the current of each component (https://source.android.com/devices/tech/power/component)

## Documentation

https://greensoftwarelab.github.io/E-MANAFA/modules.html

## SETUP

In order to run this tool, the following resources are required:
- rooted Android device (running Android 9 or above);
- *nix-based environment (MAC OS, Linux);
- Python 3.6 or above;
- Android Sdk tools (https://developer.android.com/studio/releases/platform-tools)

## 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/greensoftwarelab/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.5 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

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

### From project's root

```
$ python3 manafa/main.py [-p|--profile <prof>] 
                     [-t|--timezone <tz>] 
                     [-pft|--perfettofile <pf>] 
                     [-bts|--batstatsfile <bf>] 
```

### Source

```
# Example 
em = EManafa()
em.init()
em.start()
do_work_to_profile() # e.g time.sleep(10)
em.stop()
em.parse_results()
begin = manafa.perf_events.events[0].time  # first sample from perfetto
end = manafa.perf_events.events[-1].time  # last sample from perfetto
p, c, z = em.get_consumption_in_between(begin, end)
out_file = em.save_final_report(begin)
print(f"TOTAL: {p} Joules")
```
## Associated publications:

```
@inproceedings{
          10.1145/3551349.3561342,
          author = {Rua, Rui and Saraiva, Jo\~{a}o},
          title = {E-MANAFA: Energy Monitoring and ANAlysis Tool For Android},
          year = {2023},
          isbn = {9781450394758},
          publisher = {Association for Computing Machinery},
          address = {New York, NY, USA},
          url = {https://doi.org/10.1145/3551349.3561342},
          doi = {10.1145/3551349.3561342},
          articleno = {202},
          numpages = {4},
          location = {Rochester, MI, USA},
          series = {ASE22}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RRua/e-manafa",
    "name": "manafa",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Rui Rua",
    "author_email": "rui.rrua@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6f/b9/22859d5ffbefffad826b2a9537b999ed6722a468d00764a82de2ae7ced21/manafa-0.3.132.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://travis-ci.com/RRua/e-manafa.svg?branch=main)](https://travis-ci.com/RRua/e-manafa)\n[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)\n[![PyPI version](https://badge.fury.io/py/manafa.svg)](https://badge.fury.io/py/manafa)\n[![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/manafa)\n[![PyPI status](https://img.shields.io/pypi/status/ansicolortags.svg)](https://pypi.python.org/pypi/manafa)\n[![DOI](https://zenodo.org/badge/459943164.svg)](https://zenodo.org/badge/latestdoi/459943164)\n\n\n# E-MANAFA: Energy Monitor and ANAlyzer For Android\n\nE-MANAFA is a plug-and-play software model-based tool for performing fine-grained estimates of energy consumption on Android devices. E-Manafa estimates system-level  and per-component energy consumption, by extracting information from the following sources:\n\n- power_profile.xml: Device-specific file provided by manufacturers containing current consumption per component state;\n- batterystats: Tool from Android framework that logs each power-related event that occurs between device charges;\n- Perfetto: System-wide profiling for Linux and Android, that profiles high-frequency data, such as CPU frequency.\n\nNote: Manufacturers not always supply information about the current consumed by an individual component in the power profile file. Use this information if it accurately represents the current drawn from the device battery in practice. The file can also be derived using external apparatus such as Monsoon. Google provides a set of guidelines to estimating the current of each component (https://source.android.com/devices/tech/power/component)\n\n## Documentation\n\nhttps://greensoftwarelab.github.io/E-MANAFA/modules.html\n\n## SETUP\n\nIn order to run this tool, the following resources are required:\n- rooted Android device (running Android 9 or above);\n- *nix-based environment (MAC OS, Linux);\n- Python 3.6 or above;\n- Android Sdk tools (https://developer.android.com/studio/releases/platform-tools)\n\n## Installation\n\n### 1. Via python-pip\n\n```\npip install manafa\n```\n\n#### 1.1 define environment variables\n\nIn 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)\n\n```\nexport ANDROID_HOME=$HOME/<your-android-instalation-folder>/ \nexport PATH=$ANDROID_HOME/platform-tools:$PATH\n```\n\n### 2. From sources\n\n#### 2.1 Clone repo\n\n```\n$ git clone https://github.com/greensoftwarelab/E-MANAFA.git\n```\n\n#### 2.2 Replicate the environment\n\nInstall virtual virtualenv enviroment  (via python-pip):\n```\n$ python -m pip install --user virtualenv\n```\n#### 2.3 Replicate locally the dev virtualenv\n\n```\n$ virtualenv env/\n```\n\n#### 2.4 Activate the virtual environment\n```\n$ source env/bin/activate\n```\n\n#### 2.5 Install required packages\n```\n$ pip install -r requirements.txt\n\n```\n#### 2.6 define environment variables\n\nIn 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)\n\n```\nexport ANDROID_HOME=$HOME/<your-android-instalation-folder>/ \nexport PATH=$ANDROID_HOME/platform-tools:$PATH\n```\n## Usage\n\n### Command line\n\n```\n$ emanafa [-p|--profile <prof>] \n          [-t|--timezone <tz>] \n          [-pft|--perfettofile <pf>] \n          [-bts|--batstatsfile <bf>] \n```\n\n### From project's root\n\n```\n$ python3 manafa/main.py [-p|--profile <prof>] \n                     [-t|--timezone <tz>] \n                     [-pft|--perfettofile <pf>] \n                     [-bts|--batstatsfile <bf>] \n```\n\n### Source\n\n```\n# Example \nem = EManafa()\nem.init()\nem.start()\ndo_work_to_profile() # e.g time.sleep(10)\nem.stop()\nem.parse_results()\nbegin = manafa.perf_events.events[0].time  # first sample from perfetto\nend = manafa.perf_events.events[-1].time  # last sample from perfetto\np, c, z = em.get_consumption_in_between(begin, end)\nout_file = em.save_final_report(begin)\nprint(f\"TOTAL: {p} Joules\")\n```\n## Associated publications:\n\n```\n@inproceedings{\n          10.1145/3551349.3561342,\n          author = {Rua, Rui and Saraiva, Jo\\~{a}o},\n          title = {E-MANAFA: Energy Monitoring and ANAlysis Tool For Android},\n          year = {2023},\n          isbn = {9781450394758},\n          publisher = {Association for Computing Machinery},\n          address = {New York, NY, USA},\n          url = {https://doi.org/10.1145/3551349.3561342},\n          doi = {10.1145/3551349.3561342},\n          articleno = {202},\n          numpages = {4},\n          location = {Rochester, MI, USA},\n          series = {ASE22}\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "E-MANAFA: Energy Monitor and ANAlyzer For Android",
    "version": "0.3.132",
    "project_urls": {
        "Bug Tracker": "https://github.com/RRua/e-manafa/issues",
        "Homepage": "https://github.com/RRua/e-manafa"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fb922859d5ffbefffad826b2a9537b999ed6722a468d00764a82de2ae7ced21",
                "md5": "47825e2bdea0d6a0d0994e160b641b60",
                "sha256": "76affea7de830965e59dc0a477f439384ee549eb8f68db13387e9d8e65990780"
            },
            "downloads": -1,
            "filename": "manafa-0.3.132.tar.gz",
            "has_sig": false,
            "md5_digest": "47825e2bdea0d6a0d0994e160b641b60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 22669123,
            "upload_time": "2023-08-21T16:15:30",
            "upload_time_iso_8601": "2023-08-21T16:15:30.061564Z",
            "url": "https://files.pythonhosted.org/packages/6f/b9/22859d5ffbefffad826b2a9537b999ed6722a468d00764a82de2ae7ced21/manafa-0.3.132.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-21 16:15:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RRua",
    "github_project": "e-manafa",
    "github_not_found": true,
    "lcname": "manafa"
}
        
Elapsed time: 0.10461s