Skip to content

fix: deduplicate mirrored Linux RAPL counters - #1276

Open
lntutor wants to merge 2 commits into
mlco2:masterfrom
lntutor:fix-linux-rapl-mirrored-counters-1274
Open

fix: deduplicate mirrored Linux RAPL counters#1276
lntutor wants to merge 2 commits into
mlco2:masterfrom
lntutor:fix-linux-rapl-mirrored-counters-1274

Conversation

@lntutor

@lntutor lntutor commented Jul 26, 2026

Copy link
Copy Markdown

Summary

  • drop mirrored nonzero Linux RAPL package counters at monitoring startup
  • preserve distinct package counters, zero counters, and DRAM domains
  • document the multi-die mirrored-counter behavior

Fixes #1274

Validation

  • uv run pytest tests/test_rapl_mmio_scanning.py -q
  • uv run pytest tests/test_cpu.py tests/test_rapl_mmio_scanning.py tests/test_rapl_parameters.py -q
  • uv run ruff check codecarbon/core/cpu.py tests/test_rapl_mmio_scanning.py
  • uv run ruff format --check codecarbon/core/cpu.py tests/test_rapl_mmio_scanning.py
  • git diff --check

@lntutor
lntutor requested a review from a team as a code owner July 26, 2026 12:29
@SaboniAmine

Copy link
Copy Markdown
Member

Thanks for your contribution, that seems great!
Letting @benoit-cty validate the dedup mechanism, as he worked on the windows side.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.79%. Comparing base (663db8f) to head (3a116e8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1276      +/-   ##
==========================================
+ Coverage   89.70%   89.79%   +0.09%     
==========================================
  Files          48       48              
  Lines        4778     4791      +13     
==========================================
+ Hits         4286     4302      +16     
+ Misses        492      489       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@benoit-cty

Copy link
Copy Markdown
Contributor

Hello, you have created more than 20 repository today, I suspect you are an OpenClaw agent. I'm not against AI contribution, but a human must be accountable and willing to contribute to our project.

Please respect the PR submission template.

We will merge EMI PR in a few days then look back at this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux RAPL over-counts CPU power on multi-die CPUs (port the Windows EMI fix)

3 participants