https://github.com/wkatsak/py-rapl
Library to provide access to Intel RAPL energy counters via Python.
https://github.com/wkatsak/py-rapl
linux power python rapl
Last synced: 5 months ago
JSON representation
Library to provide access to Intel RAPL energy counters via Python.
- Host: GitHub
- URL: https://github.com/wkatsak/py-rapl
- Owner: wkatsak
- License: other
- Created: 2017-02-05T03:45:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-01-23T19:10:51.000Z (over 6 years ago)
- Last Synced: 2024-01-29T21:16:25.115Z (over 2 years ago)
- Topics: linux, power, python, rapl
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-rapl: a very simple library to sample RAPL counters via powercap/sysfs interface
## Introduction
`py-rapl` is a very simple library that supports sampling the
[RAPL](https://01.org/blogs/2014/running-average-power-limit-%E2%80%93-rapl), or *Running Average Power Limit*
energy counters that are provided by most, if not all modern Intel CPUs.
## Usage
import rapl
s1 = rapl.RAPLMonitor.sample()
# Some work that you want to measure.
s2 = rapl.RAPLMonitor.sample()
# Take the difference of the samples
diff = s2 - s1
# Print the difference in microjoules
print(diff.energy("package-0", "core", rapl.UJOULES))
# Print the average power
print(diff.average_power("package-0", "core"))