Skip to content

Adapt arm - #273

Open
lydd2024 wants to merge 4 commits into
gao-sun:masterfrom
lydd2024:adapt_arm
Open

lydd2024 wants to merge 4 commits into
gao-sun:masterfrom
lydd2024:adapt_arm

Conversation

@lydd2024

Copy link
Copy Markdown

Adapt arm cpu gpu display

luyi added 4 commits February 27, 2026 20:27
- Add AppleSiliconSensors.swift for reading temperature via IOHID API
- Use PMU tdie sensors for CPU/GPU temperature on Apple Silicon Macs
- Skip SMC calls on arm64 to avoid assertion failures
- Disable SwiftFormat build script for compatibility
- Display individual core usage with progress bars
- Show P-core (blue) and E-core (green) labels on Apple Silicon
- Add per-core temperature from PMU tdie sensors
- Calculate real-time usage from CPU tick deltas
- Add localization for cpu.cores
- Add resolvedDeviceId for Apple Silicon GPUs without device-id
- Use IOAccelerator PerformanceStatistics for GPU usage
- Fallback to AppleSiliconSensors for GPU temperature
- Display GPU core count in menu view
- Match Apple Silicon GPUs by prefix instead of PCI ID
@github-actions github-actions Bot added the needs review PR needs review label Feb 27, 2026
@betterlmy

Copy link
Copy Markdown

我感觉你可以自己基于他仓库二开一下了 他的开源协议是MIT协议的

@jevonmao jevonmao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看起来没什么大问题 But I don’t have deep expertise in the low level ARM API specifics, so it’s possible I missed something there...worth a second set of eyes from someone more familiar with that layer.

realhidden pushed a commit to realhidden/eul that referenced this pull request Sep 18, 2026
Adapts community PR gao-sun#273 onto the Xcode-26 base, with fixes:

- New AppleSiliconSensors: reads M-series die temperatures via the private
  IOHIDEventSystemClient API (AppleVendor usage page, PMU tdie sensors) with
  dlsym resolution. Unlike gao-sun#273's version, the Copy-rule CF returns (event,
  Product string) are released per read instead of leaking two objects per
  sensor per tick, the owning CFArray is retained so cached service pointers
  cannot dangle, and sensor-name fallbacks (PMU tdie -> PMU2 tdie -> SOC MTR
  Temp Sensor) cover newer chip generations.
- SmcControl: temperature getters fall back to IOHID when the SMC key is
  missing/zero, instead of gao-sun#273's exclusive #if arch(arm64) split - SMC stays
  open on Apple Silicon so fan readings keep working on machines that expose
  them.
- CpuStore: per-core usage via host_processor_info with E/P-core labels
  (hw.perflevel1.physicalcpu; efficiency cluster enumerates first). gao-sun#273's
  per-core *temperature* display was dropped: it mapped alphabetically-sorted
  PMU sensors to core indices, which is arbitrary.
- GPU on Apple Silicon: SystemProfiler gains resolvedDeviceId (AS GPUs have no
  PCI device ID), GPU.getInfo() no longer requires IOPCIMatch (AGXAccelerator),
  GpuStore matches the single shared-die GPU, and GPU core count is decoded.
- CpuMenuBlockView: per-core usage bars in the CPU menu block ("cpu.cores"
  string added to en/zh-Hans).

Verified on Apple Silicon (arm64 host, Xcode 26.3): Debug and Release both
BUILD SUCCEEDED (Release universal x86_64+arm64); live run caches 64 IOHID
sensor services; standalone harness reads 63 sensors with plausible values
and cpuTemperature 48.0C. Known cosmetic follow-up: SMC lists two unreadable
keys on AS whose failed reads log per tick before the IOHID fallback kicks in.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
realhidden pushed a commit to realhidden/eul that referenced this pull request Sep 18, 2026
Adapts community PR gao-sun#273 onto the Xcode-26 base, with fixes:

- New AppleSiliconSensors: reads M-series die temperatures via the private
  IOHIDEventSystemClient API (AppleVendor usage page, PMU tdie sensors) with
  dlsym resolution. Unlike gao-sun#273's version, the Copy-rule CF returns (event,
  Product string) are released per read instead of leaking two objects per
  sensor per tick, the owning CFArray is retained so cached service pointers
  cannot dangle, and sensor-name fallbacks (PMU tdie -> PMU2 tdie -> SOC MTR
  Temp Sensor) cover newer chip generations.
- SmcControl: temperature getters fall back to IOHID when the SMC key is
  missing/zero, instead of gao-sun#273's exclusive #if arch(arm64) split - SMC stays
  open on Apple Silicon so fan readings keep working on machines that expose
  them.
- CpuStore: per-core usage via host_processor_info with E/P-core labels
  (hw.perflevel1.physicalcpu; efficiency cluster enumerates first). gao-sun#273's
  per-core *temperature* display was dropped: it mapped alphabetically-sorted
  PMU sensors to core indices, which is arbitrary.
- GPU on Apple Silicon: SystemProfiler gains resolvedDeviceId (AS GPUs have no
  PCI device ID), GPU.getInfo() no longer requires IOPCIMatch (AGXAccelerator),
  GpuStore matches the single shared-die GPU, and GPU core count is decoded.
- CpuMenuBlockView: per-core usage bars in the CPU menu block ("cpu.cores"
  string added to en/zh-Hans).

Verified on Apple Silicon (arm64 host, Xcode 26.3): Debug and Release both
BUILD SUCCEEDED (Release universal x86_64+arm64); live run caches 64 IOHID
sensor services; standalone harness reads 63 sensors with plausible values
and cpuTemperature 48.0C. Known cosmetic follow-up: SMC lists two unreadable
keys on AS whose failed reads log per tick before the IOHID fallback kicks in.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review PR needs review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants