Skip to content

Fix Apple Silicon power readings scaling with update interval#3018

Open
eyupcanakman wants to merge 1 commit intoexelban:masterfrom
eyupcanakman:fix/power-readings-update-interval-2777
Open

Fix Apple Silicon power readings scaling with update interval#3018
eyupcanakman wants to merge 1 commit intoexelban:masterfrom
eyupcanakman:fix/power-readings-update-interval-2777

Conversation

@eyupcanakman
Copy link

Fixes #2777

Summary

On Apple Silicon, CPU, GPU, ANE, RAM, and PCI power readings increased with the selected update interval because the Sensors reader treated the raw IOReport energy delta as a power value.

Convert the delta to power by dividing it by the elapsed time between samples. Keep the existing first-read behavior and update the sample timestamp when a read returns no power value.

Testing

  • Reproduced in the app and confirmed CPU power no longer doubles at 2s or scales at 5s
  • swiftlint lint --no-cache
  • xcodebuild -project Stats.xcodeproj -scheme Stats -destination platform=macOS -derivedDataPath /tmp/stats-dd-2777 test -only-testing:Tests CODE_SIGNING_ALLOWED=NO
  • xcodebuild -project Stats.xcodeproj -scheme Stats -destination platform=macOS -configuration Release -derivedDataPath /tmp/stats-dd-2777 archive CODE_SIGNING_ALLOWED=NO

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.

CPU/GPU/ANE Power Readings Doubled at ≥2s Update Interval

1 participant