Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: powerapi-ng/powerapi
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.9.1
Choose a base ref
...
head repository: powerapi-ng/powerapi
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
30 changes: 18 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -21,30 +21,36 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[devel]"
uv sync --extra everything --dev
- name: Run flake8
run: |
uv run flake8 --count --show-source --statistics src/ tests/
- name: Lint with flake8
- name: Run pylint
run: |
flake8 --count --show-source --statistics src/ tests/
uv run pylint src/ tests/
- name: Static code analysis with pylint
- name: Run ruff
run: |
pylint src/ tests/
uv run ruff check --output-format=github src/ tests/
- name: Test with pytest
- name: Run unit tests with coverage
run: |
pytest --cov=powerapi --cov-report=term --cov-report=xml tests/unit
uv run pytest --cov=powerapi --cov-report=term --cov-report=xml tests/unit
- name: Upload coverage reports to Codecov
if: ${{ matrix.python-version }} == "3.10"
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
@@ -55,10 +61,10 @@ jobs:

steps:
- name: Setup Docker buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0

- name: Build image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
push: false
provenance: false
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -30,15 +30,15 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/autobuild@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
with:
category: "/language:${{matrix.language}}"
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -50,12 +50,12 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: "3.x"

- name: Install uv
uses: astral-sh/setup-uv@5f42d5af6c403a722299fda36d451c39f302a433 # v4.1.0
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2

- name: Build sdist and wheel
run: |
@@ -68,7 +68,7 @@ jobs:
cd ./dist && echo "hash=$(sha256sum -- * | base64 -w0)" >> $GITHUB_OUTPUT
- name: Upload build artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: "python-build-dist"
path: ./dist
@@ -102,7 +102,7 @@ jobs:
path: dist

- name: Publish package
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
print-hash: true
attestations: true
@@ -117,10 +117,10 @@ jobs:

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 # v3.4.0

- name: Setup Docker buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0

- name: Log in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
@@ -146,7 +146,7 @@ jobs:
type=pep440,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
id: build-and-push
with:
push: true
@@ -190,7 +190,7 @@ jobs:
path: dist

- name: Create GitHub release
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
body_path: CHANGELOG.md
files: |
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ disable=raw-checker-failed,
invalid-overridden-method,
abstract-method,
broad-exception-caught,
deprecated-module


[REPORTS]
46 changes: 46 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
target-version = "py310" # should match minimal python version of PowerAPI

[lint]
select = [
"F", # pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"B", # flake8-bugbear
"G", # flake8-logging-format
"PT", # flake8-pytest-style
"UP", # pyupgrade
"ERA", # eradicate
"RUF", # ruff
]

ignore = [
"E501", # line too long

"UP006", # non-pep585-annotation
"UP007", # non-pep604-annotation-union
"UP015", # redundant-open-modes
"UP031", # printf-string-formatting
"UP035", # deprecated-import
"B006", # mutable-argument-default
"B008", # function-call-in-default-argument
"F401", # unused-import
"ERA001", # commented-out-code
"G003", # logging-string-concat
"G004", # logging-f-string
"RUF005", # collection-literal-concatenation
"RUF013", # implicit-optional
"RUF015", # unnecessary-iterable-allocation-for-first-element

"UP026", # deprecated-mock-import
"B005", # strip-with-multi-characters
"B010", # set-attr-with-constant
"B011", # assert-false
"B017", # assert-raises-exception
"B905", # zip-without-explicit-strict
"E721", # type-comparison
"PT001", # pytest-fixture-incorrect-parentheses-style
"PT011", # pytest-raises-too-broad
"PT012", # pytest-raises-with-multiple-statements
"PT015", # pytest-assert-always-false
"PT022", # pytest-useless-yield-fixture
]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3-slim@sha256:4efa69bf17cfbd83a9942e60e2642335c3b397448e00410063a0421f9727c4c4
FROM python:3-slim@sha256:ae9f9ac89467077ed1efefb6d9042132d28134ba201b2820227d46c9effd3174

RUN useradd -m -s /bin/bash powerapi
WORKDIR /home/powerapi
2 changes: 0 additions & 2 deletions docs/.gitignore

This file was deleted.

19 changes: 0 additions & 19 deletions docs/Makefile

This file was deleted.

6 changes: 0 additions & 6 deletions docs/generate.sh

This file was deleted.

4 changes: 4 additions & 0 deletions docs/joss-paper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore inara output files.
# https://github.com/openjournals/inara
jats/*
paper.pdf
3 changes: 3 additions & 0 deletions docs/joss-paper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# PowerAPI paper for the [Journal of Open Source Software](https://joss.theoj.org/)
This folder contains the source of the [PowerAPI paper submitted to the JOSS journal](https://joss.theoj.org/papers/10.21105/joss.06670).
You can [follow the steps on the official documentation](https://joss.readthedocs.io/en/latest/paper.html#checking-that-your-paper-compiles) to build the pdf of the paper.
Binary file added docs/joss-paper/client-consumption-sn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/joss-paper/client-consumption-ts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
144 changes: 144 additions & 0 deletions docs/joss-paper/paper.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
@misc{hwpc-sensor,
author = {G. Fieni and R. Rouvoy},
title = {Hardware Performance Counters (HwPC) Sensor},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
url = {https://github.com/powerapi-ng/hwpc-sensor}
}

@misc{powerapi-core,
author = {G. Fieni and D. Romero and R. Rouvoy},
title = {PowerAPI Core},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
url = {https://github.com/powerapi-ng/powerapi}
}

@misc{smartwatts,
author = {G. Fieni and D.Romero and R. Rouvoy},
title = {SmartWatts Formula},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
url = {https://github.com/powerapi-ng/smartwatts-formula}
}

@inproceedings{fieni:2020,
TITLE = {Smart{W}atts: Self-Calibrating Software-Defined Power Meter for Containers},
AUTHOR = {Fieni, Guillaume and Rouvoy, Romain and Seinturier, Lionel},
URL = {https://inria.hal.science/hal-02470128},
BOOKTITLE = {CCGRID 2020 - 20th IEEE/ACM International Symposium on Cluster, Cloud and Internet Computing},
ADDRESS = {Melbourne, Australia},
YEAR = {2020},
MONTH = May,
DOI = {10.1109/CCGrid49817.2020.00-45},
KEYWORDS = {powerapi ; containers ; Power model ; energy},
PDF = {https://inria.hal.science/hal-02470128/file/smartwatts-paper.pdf},
HAL_ID = {hal-02470128},
HAL_VERSION = {v1},
DOI = {10.1109/CCGrid49817.2020.00-45},
}

@article{pedregosa:2011,
title={Scikit-learn: Machine learning in {P}ython},
author={Pedregosa, Fabian and Varoquaux, Ga{\"e}l and Gramfort, Alexandre and Michel, Vincent and Thirion, Bertrand and Grisel, Olivier and Blondel, Mathieu and Prettenhofer, Peter and Weiss, Ron and Dubourg, Vincent and others},
journal={Journal of machine learning research},
volume={12},
number={Oct},
pages={2825--2830},
year={2011},
}

@manual{intel:2023,
author = {Intel Corporation},
keywords = {Architectures Manual},
month = {December},
organization = {Intel Corporation},
title = {Intel 64 and IA-32 Architectures Software Developer's Manual - Combined Volumes: 1, 2A, 2B, 2C, 2D, 3A, 3B, 3C, 3D, and 4},
year = 2023
}

@inproceedings{hewitt:1973,
author = {Hewitt, Carl and Bishop, Peter and Steiger, Richard},
title = {A universal modular ACTOR formalism for artificial intelligence},
year = {1973},
publisher = {Morgan Kaufmann Publishers Inc.},
address = {San Francisco, CA, USA},
abstract = {This paper proposes a modular ACTOR architecture and definitional method for artificial intelligence that is conceptually based on a single kind of object: actors [or, if you will, virtual processors, activation frames, or streams]. The formalism makes no presuppositions about the representation of primitive data structures and control structures. Such structures can be programmed, micro-coded, or hard wired in a uniform modular fashion. In fact it is impossible to determine whether a given object is "really" represented as a list, a vector, a hash table, a function, or a process. The architecture will efficiently run the coming generation of PLANNER-like artificial intelligence languages including those requiring a high degree of parallelism. The efficiency is gained without loss of programming generality because it only makes certain actors more efficient; it does not change their behavioral characteristics. The architecture is general with respect to control structure and does not have or need goto, interrupt, or semaphore primitives. The formalism achieves the goals that the disallowed constructs are intended to achieve by other more structured methods.},
booktitle = {Proceedings of the 3rd International Joint Conference on Artificial Intelligence},
pages = {235–245},
numpages = {11},
location = {Stanford, USA},
series = {IJCAI'73},
}

@book{agha:1986,
author = {Agha, Gul},
title = {Actors: a model of concurrent computation in distributed systems},
year = {1986},
isbn = {0262010925},
publisher = {MIT Press},
address = {Cambridge, MA, USA}
}

@inproceedings{fieni:2021,
TITLE = {SELFWATTS: On-the-fly Selection of Performance Events to Optimize Software-defined Power Meters},
AUTHOR = {Fieni, Guillaume and Rouvoy, Romain and Seinturier, Lionel},
URL = {https://inria.hal.science/hal-03173410},
BOOKTITLE = {CCGRID 2021 - 21th IEEE/ACM International Symposium on Cluster, Cloud and Internet Computing},
ADDRESS = {Melbourne, Australia},
YEAR = {2021},
MONTH = May,
KEYWORDS = {Powerapi ; containers ; Virtual machines ; power model ; energy},
PDF = {https://inria.hal.science/hal-03173410/file/selfwatts-paper.pdf},
HAL_ID = {hal-03173410},
HAL_VERSION = {v1},
DOI = {10.1109/ccgrid51090.2021.00042},
}

@article{colmant:2018,
TITLE = {The Next 700 {CPU} Power Models},
AUTHOR = {Colmant, Maxime and Rouvoy, Romain and Kurpicz, Mascha and Sobe, Anita and Felber, Pascal and Seinturier, Lionel},
URL = {https://inria.hal.science/hal-01827132},
JOURNAL = {Journal of Systems and Software},
PUBLISHER = {{Elsevier}},
VOLUME = {144},
PAGES = {382-396},
YEAR = {2018},
MONTH = Jul,
DOI = {10.1016/j.jss.2018.07.001},
KEYWORDS = {software toolkit ; energy monitoring ; power models ; software-defined power meters ; open testbed},
PDF = {https://inria.hal.science/hal-01827132v2/file/colmant-jss.pdf},
HAL_ID = {hal-01827132},
HAL_VERSION = {v2},
}

@inproceedings{colmant:2017,
TITLE = {Watts{K}it: Software-Defined Power Monitoring of Distributed Systems},
AUTHOR = {Colmant, Maxime and Felber, Pascal and Rouvoy, Romain and Seinturier, Lionel},
URL = {https://inria.hal.science/hal-01439889},
BOOKTITLE = {17th IEEE/ACM International Symposium on Cluster, Cloud and Grid Computing ({CCGrid})},
ADDRESS = {Madrid, Spain},
EDITOR = {Franck Capello and Geoffrey Fox and Javier Garcia-Blas},
PUBLISHER = {{IEEE}},
SERIES = {Proceedings of the 17th IEEE/ACM International Symposium on Cluster, Cloud and Grid Computing (CCGrid)},
PAGES = {10},
YEAR = {2017},
MONTH = May,
KEYWORDS = {energy ; cluster ; power ; model ; middleware ; power meter},
PDF = {https://inria.hal.science/hal-01439889/file/colmant-ccgrid17-camera-ready.pdf},
HAL_ID = {hal-01439889},
HAL_VERSION = {v1},
DOI = {10.1109/ccgrid.2017.27},
}

@inproceedings{lebeane:2015,
author={LeBeane, Michael and Ryoo, Jee Ho and Panda, Reena and John, Lizy Kurian},
booktitle={2015 27th International Symposium on Computer Architecture and High Performance Computing (SBAC-PAD)},
title={Watt Watcher: Fine-Grained Power Estimation for Emerging Workloads},
year={2015},
pages={106-113},
keywords={Radiation detectors;Program processors;Power measurement;Microarchitecture;Hardware;Power demand;Monitoring},
doi={10.1109/SBAC-PAD.2015.26}}
Loading