fix: Add Apple M5 Pro/Max Super core (S-CPU) and new IOReport channel support#168
Conversation
…MCPU channel support Add support for the Apple M5 Pro/Max 3-tier CPU architecture (Super + Performance, no Efficiency cores). Previously only 6 of 18 cores were monitored on M5 Max because the code only matched E*/ECPU and P*/PCPU IOReport channels, missing all MCPU channels. Changes: - Add CoreType::Super variant and s_core fields to AppleSiliconCpuInfo - Read hw.perflevelN.name via sysctl to dynamically detect Super vs Performance mapping - Handle MCPU0* channels as Super cores and MCPU1* as Performance cluster in IOReport - Thread s_cluster metrics through NativeMetricsData and IOReportMetrics - Display S-CPU/P-CPU gauges for M5, P-CPU/E-CPU for M1-M4 in TUI - Export s_core metrics in Prometheus API format - Full backward compatibility with M1/M2/M3/M4 chips preserved Closes #167
Add missing all_smi_cpu_s_cluster_frequency_mhz Prometheus metric for M5 Pro/Max Super cores, and add dedicated s_idx counter in activity panel per-core view to avoid sharing the Standard core counter.
Implementation Review SummaryIntent
Findings Addressed
Remaining Items
Verification
Review DetailsCoreType::Super enum — properly added to both IOReport MCPU channel parsing — sysctl perflevel detection — TUI display — Prometheus export — Backward compatibility — All S-core fields default to 0/None when |
…size The original code acquired cached_s_core_count mutex twice in the same if-expression. Rust drops temporaries at statement end, not at &&, so when the first condition evaluated to true the second .lock() would deadlock. Consolidate into a single lock acquisition with matches!.
Security & Performance ReviewFixed[MEDIUM] Mutex deadlock in The original code acquired if *self.cached_s_core_count.lock().unwrap() != Some(0)
&& self.cached_s_core_count.lock().unwrap().is_some()Rust drops temporaries at statement end, not at Fixed by consolidating into a single lock acquisition: Commit: ed56f3e No issues found (reviewed and passed)
|
Add three test cases to metrics_parser covering the new S-core fields introduced for Apple M5 Pro/Max support: - test_parse_m5_super_core_metrics: verifies s_core_count and s_core_utilization are parsed correctly from Prometheus metrics - test_parse_m5_per_core_super_type: verifies CoreType::Super is assigned when core_type="S" in per-core utilization metrics - test_m5_backward_compat_m1_m4_no_super_cores: verifies M1-M4 chips without S-core metrics default s_core_count and s_core_utilization to zero
PR Finalization CompleteSummary
Total test count: 311 → 312 (all passing). |
Summary
CoreType::Supervariant ands_core_*fields toAppleSiliconCpuInfofor the M5 Pro/Max 3-tier CPU architecture (Super + Performance, no Efficiency cores)hw.perflevelN.namevia sysctl instead of hardcoding perflevel0=P, perflevel1=EMCPU0*IOReport channels as Super cores andMCPU1*as Performance cluster, fixing the issue where only 6 of 18 cores were monitored on M5 MaxCloses #167
Test plan
cargo clippyclean (no warnings)cargo fmt --checkcleanall_smi_cpu_s_core_countandall_smi_cpu_s_core_utilizationmetrics on M5