Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

[![Build Status](https://travis-ci.org/TQRG/physalia.svg?branch=master)](https://travis-ci.org/TQRG/physalia)
[![PyPI version](https://badge.fury.io/py/physalia.svg)](https://badge.fury.io/py/physalia)
[![PyPI downloads](https://img.shields.io/pypi/d/physalia.svg)](https://pypi.python.org/pypi/physalia)
[![PyPI status](https://img.shields.io/pypi/status/physalia.svg)](https://pypi.python.org/pypi/physalia)
[![Code Health](https://landscape.io/github/TQRG/physalia/master/landscape.svg?style=flat)](https://landscape.io/github/TQRG/physalia/master)


# Physalia

Energy measurement framework for Mobile Apps.

More info and documentation in the [website](https://tqrg.github.io/physalia/).

## Install

```
$ pip install https://github.com/luiscruz/PyMonsoon
$ pip install physalia
```

## Example

The simplest way to measure something:

```
from physalia.power_meters import MonsoonPowerMeter
from time import sleep

# change voltage and serial number accordingly:
power_meter = MonsoonPowerMeter(voltage=3.8, serial=12886)
power_meter.start()
sleep(2) # some work
energy_consumption, duration, error_flag = power_meter.stop()
```

Several things need to be done to make sure we can measure energy consumption in Android devices (e.g., setup WiFi control and disable USB).
Physalia takes care of that already:



````
from physalia.power_meters import MonsoonPowerMeter
from physalia.energy_profiler import AndroidUseCase
from time import sleep

# change voltage and serial number accordingly:
power_meter = MonsoonPowerMeter(voltage=3.8, serial=12886)

def run(usecase):
sleep(2) # some work

use_case = AndroidUseCase(
'login',
'path/to/apk',
'com.test.app',
'0.0',
prepare=None,
run=run,
cleanup=None
)
measurement = use_case.run(power_meter=power_meter)
print(measurement)
````

## Contributing

Please help us improve this library!

If you have ideas for new features or anything behaves unexpectedly please report an issue.

If you find an issue you can actually help fixing please make a pull request of your code.

### Running tests

To run all tests and checks locally run:

`$ detox -e py27,py36`

Metadata

Release files for physalia 0.0.1.dev122

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for physalia 0.0.1.dev122
File Size Uploaded Provenance
physalia-0.0.1.dev122.tar.gz 7.3 MB Without provenance Details

Release files / physalia-0.0.1.dev122.tar.gz

Download URL physalia-0.0.1.dev122.tar.gz
Size 7.3 MB
Tags Source
SHA-256 checksum
How to use checksums
5bad7ba0a4e623938c097e14917dc23918e95257a85a9e725f81d1276863fa5d
BLAKE2b-256 checksum
How to use checksums
f4b6673abab6f49cf1b68bf7dfdc9f9b9c66450384d368f3cf597c6a125d8762
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.8.1 pkginfo/1.4.1 requests/2.9.1 setuptools/1.1.6 requests-toolbelt/0.7.1 clint/0.5.1 CPython/2.7.10 Darwin/15.6.0

Security for physalia 0.0.1.dev122

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page