1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Copyright 2025 Lablup Inc. and Jeongkyu Shin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Module for device readers with reduced code duplication
// Chassis-level monitoring (node power, thermal, BMC)
// Common caching utilities shared across all readers
// `GpuInfo::detail` key conventions (`Metrics Source`, `Source: <field>`).
// Unconditional on purpose: the layers that write these keys sit behind
// disjoint `cfg` gates and cannot call helpers held inside one another.
// Native Apple Silicon reader using IOReport/SMC (no sudo required)
// The main crate owns only a runtime loader. The companion cdylib keeps
// `libamdgpu_top` and its libdrm linkage out of every consumer binary.
// Intel client GPU (Arc / Iris / Xe) — see issue #244. Sysfs on Linux,
// WMI on Windows. The PCI-ID name lookup and low-level sysfs helpers
// live in sibling modules so the per-OS reader files stay small.
// `intel_gpu_names` is platform-agnostic (pure string matching) and is
// available on both Linux and Windows so the architecture / SYCL
// classification can be reused by both per-OS readers and by external
// consumers of the library.
// Intel Level Zero (oneAPI) backend. Cross-platform FFI shim that prefers
// Sysman metrics per field when available, while keeping sysfs/WMI as the
// baseline and fallback.
//
// `all_smi_level_zero` is emitted by `build.rs` for every Linux and
// Windows target, and for nothing else. The backend adds no dependency
// (the loader is `dlopen`d) and opens nothing on a machine with no Intel
// GPU, so there is no build worth opting out of; the `level_zero` cargo
// feature survives only as an accepted no-op.
// The `test` arm is load-bearing for the same reason it is on
// `windows_gpu_perf` below. The discrete/integrated and architecture rules
// live here, the Windows reader that consumes them is never compiled by any
// runner this project has, and a wrong rule there is invisible until it
// reaches a user's machine. That is how the B390 shipped misclassified
// (issue #364). Compiling under `cfg(test)` everywhere puts the rules in
// front of every test runner, including a macOS development host.
// The helpers themselves only use portable filesystem APIs, so keep their unit
// tests available on non-Linux development hosts as well.
// Vendor-neutral Windows GPU metrics (DXGI + PDH).
//
// The `test` arm is load-bearing, not incidental. No CI job builds this
// crate for Windows at all, so the counter-instance parsing, the
// utilization aggregation, and the WMI-to-adapter pairing would ship
// with zero automated coverage if this were gated on Windows alone.
// Compiling it under `cfg(test)` everywhere puts that logic in front of
// the Linux test runner, which is the only runner this repository
// actually has. Same shape as `intel_gpu_sysfs` above.
// AMD ADL sensor augmentation (temperature, power, fan, clocks) layered
// on top of `windows_gpu_perf`. Gated the same way and for the same
// reason: the sensor-index mapping and the field application are the
// parts most likely to be wrong, so they must reach the Linux test
// runner.