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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
//! Machine-readable ontology over everything IronMonitor can report.
//!
//! The three interfaces — CLI, TUI, GUI — all render the same underlying readings,
//! but until now each described them in its own words. `cli board` printed
//! `Kernel:`, the GUI printed `Kernel Version`, and the JSON output used
//! `kernel_version`; an agent reading one could not reliably talk about the others.
//! This module is the single naming authority the three surfaces agree on.
//!
//! ## What an entity is
//!
//! Every value IronMonitor can report has a stable dotted id — `gpu.0.thermal.temperature`,
//! `cpu.total.utilization`, `disk.0.capacity` — plus a unit and, most importantly,
//! a [`Provenance`].
//!
//! ## Why provenance is the point
//!
//! An agent reading `gpu.0.thermal.critical_temperature = null` learns nothing about
//! *why* it is null, and an agent reading `= 110` cannot tell whether the hardware
//! said so or whether a table of plausible constants did. That distinction is not
//! cosmetic: this repository has repeatedly shipped invented numbers through the same
//! field as measured ones — a boot time of exactly 45s assigned whenever it could not
//! be read, a GPU power percentage whose denominator came from a core-count lookup,
//! Secure Boot reported from the existence of a registry key rather than its value.
//! Each was indistinguishable from a real reading at the point of consumption.
//!
//! [`Provenance`] makes the distinction explicit and machine-checkable, so an agent
//! can refuse to reason about a specification constant as though it were a sample.
pub mod resolve;
pub mod capability;
pub mod jsonld;
pub mod vocabulary;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
/// Ontology format version. Bump the major on any breaking id or field change.
pub const ONTOLOGY_VERSION: &str = "1.0";
/// Where a value came from.
///
/// This is the field that distinguishes a reading from a guess. It is deliberately
/// not defaultable: every entity must state its provenance explicitly.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Provenance {
/// Sampled from hardware or the OS during this collection cycle.
Measured,
/// A published constant — a spec sheet, a vendor table, a documented default.
/// True of the hardware, but not observed on *this* machine right now.
Specification,
/// Computed from other entities. `derived_from` names the inputs.
Derived,
/// Not obtainable here: unsupported platform, absent device, missing permission.
/// A consumer must render this as "unknown", never as zero.
Unavailable,
}
impl Provenance {
/// Whether a value with this provenance may be treated as a live observation.
///
/// The guard an agent should apply before reasoning about a number as fact.
/// `Specification` values are true but stale; `Derived` values inherit the
/// weakest provenance of their inputs and so must be checked through those.
pub fn is_observation(self) -> bool {
matches!(self, Self::Measured)
}
pub fn as_str(self) -> &'static str {
match self {
Self::Measured => "measured",
Self::Specification => "specification",
Self::Derived => "derived",
Self::Unavailable => "unavailable",
}
}
}
/// Physical unit of a value. `None` on the entity means dimensionless or textual.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Unit {
Celsius,
Percent,
Bytes,
BytesPerSecond,
Hertz,
Megahertz,
MegatransfersPerSecond,
Watts,
Milliwatts,
Volts,
Rpm,
Seconds,
Hours,
Milliseconds,
Count,
Identifier,
Text,
}
impl Unit {
pub fn as_str(self) -> &'static str {
match self {
Self::Celsius => "celsius",
Self::Percent => "percent",
Self::Bytes => "bytes",
Self::BytesPerSecond => "bytes_per_second",
Self::Hertz => "hertz",
Self::Megahertz => "megahertz",
Self::MegatransfersPerSecond => "megatransfers_per_second",
Self::Watts => "watts",
Self::Milliwatts => "milliwatts",
Self::Volts => "volts",
Self::Rpm => "rpm",
Self::Seconds => "seconds",
Self::Hours => "hours",
Self::Milliseconds => "milliseconds",
Self::Count => "count",
Self::Identifier => "identifier",
Self::Text => "text",
}
}
/// Whether a negative value is physically meaningful for this unit.
///
/// Used by [`Entity::validate_range`] so a consumer can reject impossible
/// readings without hardcoding per-field knowledge.
pub fn allows_negative(self) -> bool {
matches!(self, Self::Celsius | Self::Volts)
}
}
/// What kind of thing an entity is, which determines how an agent may use it.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum EntityKind {
/// A sampled quantity that changes over time.
Measurement,
/// A fixed property of the device — model name, capacity, core count.
Identity,
/// A value that can be written back, subject to the apply layer's confirmation.
Setting,
/// A limit or threshold the hardware declares.
Limit,
/// Not a property of the hardware but a statement about the reading process
/// itself — that a domain enumerated nothing, or that a list was truncated.
/// These exist because silence is the one answer a resolver must never give: an
/// agent that receives no `disk.*` rows cannot tell an absent device from an
/// unimplemented reader, and a capped list presented as complete invites the
/// conclusion that a process is absent when it was merely ranked eleventh.
Diagnostic,
}
impl EntityKind {
pub fn as_str(self) -> &'static str {
match self {
Self::Measurement => "measurement",
Self::Identity => "identity",
Self::Setting => "setting",
Self::Limit => "limit",
Self::Diagnostic => "diagnostic",
}
}
}
/// The subsystem an entity belongs to. Mirrors the CLI's top-level nouns so that
/// `ironmon cli gpu` and the `gpu.*` id space are obviously the same thing.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Domain {
Cpu,
Gpu,
Memory,
Disk,
Network,
Power,
Thermal,
Process,
System,
Board,
Pci,
Usb,
}
impl Domain {
pub const ALL: &'static [Domain] = &[
Domain::Cpu,
Domain::Gpu,
Domain::Memory,
Domain::Disk,
Domain::Network,
Domain::Power,
Domain::Thermal,
Domain::Process,
Domain::System,
Domain::Board,
Domain::Pci,
Domain::Usb,
];
pub fn as_str(self) -> &'static str {
match self {
Self::Cpu => "cpu",
Self::Gpu => "gpu",
Self::Memory => "memory",
Self::Disk => "disk",
Self::Network => "network",
Self::Power => "power",
Self::Thermal => "thermal",
Self::Process => "process",
Self::System => "system",
Self::Board => "board",
Self::Pci => "pci",
Self::Usb => "usb",
}
}
pub fn parse(s: &str) -> Option<Self> {
Self::ALL
.iter()
.copied()
.find(|d| d.as_str().eq_ignore_ascii_case(s))
}
}
/// One named thing IronMonitor can report.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Entity {
/// Stable dotted id. `{domain}.{instance}.{path}`, where `instance` is omitted
/// for singletons (`memory.total`) and is an index otherwise (`gpu.0.name`).
/// Ids are the contract: they may be added, but never repurposed.
pub id: String,
pub domain: Domain,
pub kind: EntityKind,
#[serde(skip_serializing_if = "Option::is_none")]
pub unit: Option<Unit>,
pub provenance: Provenance,
/// Whether the reader may legitimately have no value for this. A `false` here
/// with a null value is a bug in the reader, not an absent device.
pub nullable: bool,
/// One line, written for a reader that cannot see the hardware.
pub description: String,
/// Ids this value is computed from. Non-empty only for [`EntityKind`] entries
/// whose provenance is [`Provenance::Derived`].
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub derived_from: Vec<String>,
/// The `ironmon profile set` id that writes this, when one exists.
#[serde(skip_serializing_if = "Option::is_none")]
pub writable_via: Option<String>,
}
impl Entity {
fn new(
id: &str,
domain: Domain,
kind: EntityKind,
unit: Option<Unit>,
provenance: Provenance,
nullable: bool,
description: &str,
) -> Self {
Self {
id: id.to_string(),
domain,
kind,
unit,
provenance,
nullable,
description: description.to_string(),
derived_from: Vec::new(),
writable_via: None,
}
}
fn derived(mut self, from: &[&str]) -> Self {
self.provenance = Provenance::Derived;
self.derived_from = from.iter().map(|s| s.to_string()).collect();
self
}
/// Check a concrete value against what this entity's unit permits.
///
/// Returns the reason it is impossible, or `None` if it is admissible. This is
/// the same class of assertion as the `plausibility` test tier, exposed so that
/// an agent consuming the JSON can apply it without reimplementing the rules.
pub fn validate_range(&self, value: f64) -> Option<String> {
let unit = self.unit?;
if value.is_nan() {
return Some(format!("{} is NaN", self.id));
}
if value < 0.0 && !unit.allows_negative() {
return Some(format!(
"{} = {value} is negative, which {} cannot be",
self.id,
unit.as_str()
));
}
if unit == Unit::Percent && value > 100.0 {
return Some(format!("{} = {value} exceeds 100 percent", self.id));
}
if unit == Unit::Celsius && !(-273.15..=200.0).contains(&value) {
return Some(format!(
"{} = {value}C is outside any temperature real hardware reports",
self.id
));
}
None
}
}
/// The full set of entities IronMonitor knows how to name.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Ontology {
pub version: String,
/// Keyed by id so lookups are O(log n) and the JSON is stable across runs.
pub entities: BTreeMap<String, Entity>,
}
impl Default for Ontology {
fn default() -> Self {
Self::build()
}
}
/// The ontology domain a writable setting belongs to.
///
/// Shared with the resolver, which publishes each setting's current value under
/// the id this mapping builds. Two copies would let the entity and the reading
/// drift into different ids, and the drift would show up as an entity that is
/// declared, never produced, and reported "no resolver bound" -- which is
/// exactly the state this function was written to get out of.
pub(crate) fn setting_domain(subsystem: crate::profile::Subsystem) -> Domain {
match subsystem {
crate::profile::Subsystem::Gpu => Domain::Gpu,
crate::profile::Subsystem::Cpu => Domain::Cpu,
crate::profile::Subsystem::Memory => Domain::Memory,
// NVMe parameters are disk-level; display has no ontology domain of its
// own and its settings are board-level firmware state.
crate::profile::Subsystem::Nvme => Domain::Disk,
crate::profile::Subsystem::Display => Domain::Board,
}
}
impl Ontology {
/// Construct the ontology. Pure — no hardware is touched, so this is safe to call
/// on any machine and produces identical output everywhere, which is what makes
/// it usable as a schema an agent can fetch ahead of time.
pub fn build() -> Self {
let mut entities = BTreeMap::new();
let mut add = |e: Entity| {
debug_assert!(
!entities.contains_key(&e.id),
"duplicate ontology id: {}",
e.id
);
entities.insert(e.id.clone(), e);
};
use Domain as D;
use EntityKind as K;
use Provenance as P;
use Unit as U;
// ── CPU ──────────────────────────────────────────────────────────────
add(Entity::new(
"cpu.model",
D::Cpu,
K::Identity,
Some(U::Text),
P::Measured,
// Nullable: an empty model string is a failed read, not a CPU
// without a name, and the resolver reports it as absent.
true,
"Processor model string as the CPU reports it.",
));
add(Entity::new(
"cpu.cores.physical",
D::Cpu,
K::Identity,
Some(U::Count),
P::Measured,
// Nullable: the resolver reports it absent both when the
// reader errors and when the platform gives no physical count
// distinct from the logical one.
true,
"Physical core count, excluding SMT siblings.",
));
add(Entity::new(
"cpu.cores.logical",
D::Cpu,
K::Identity,
Some(U::Count),
P::Measured,
false,
"Logical processor count, including SMT siblings.",
));
add(Entity::new(
"cpu.total.utilization",
D::Cpu,
K::Measurement,
Some(U::Percent),
P::Measured,
// Nullable: the resolver reports it absent when the CPU stats
// reader errors.
true,
concat!(
"System-wide CPU busy percentage over the last sampling ",
"interval. That interval is the time since the previous call, ",
"not a fixed window: two snapshots taken back to back make the ",
"second one span milliseconds, and it will report whatever ",
"happened in those milliseconds. Measured here at 17.9% then ",
"6.7% from consecutive calls on an idle machine, and steady at ",
"55.7-56.2% across five spaced calls with half the cores ",
"loaded, against an independent per-core mean of 55.7%. Space ",
"the calls out to get a figure that means anything."
),
)
.derived(&["cpu.total.idle"]));
add(Entity::new(
"cpu.total.idle",
D::Cpu,
K::Measurement,
Some(U::Percent),
P::Measured,
false,
"System-wide idle percentage over the last sampling interval.",
));
add(Entity::new(
"cpu.core.{n}.utilization",
D::Cpu,
K::Measurement,
Some(U::Percent),
P::Derived,
true,
"Per-core busy percentage. Null where the platform exposes no \
per-processor times — deliberately not the system average. Derived \
rather than measured because no platform reports it: the resolver \
computes `100 - idle` from per-core times, which is what the \
reading has always been.",
)
.derived(&["cpu.core.{n}.idle"]));
add(Entity::new(
"cpu.core.{n}.idle",
D::Cpu,
K::Measurement,
Some(U::Percent),
P::Measured,
true,
"Per-core idle percentage over the last sampling interval. The \
measured half of the pair: `utilization` beside it is `100 - idle`, \
and naming the input is what lets a consumer see that the two are \
one reading rather than two.",
));
add(Entity::new(
"cpu.core.{n}.frequency.max",
D::Cpu,
K::Limit,
Some(U::Megahertz),
P::Specification,
true,
concat!(
"Rated maximum core clock, as the firmware reports it. A ",
"boosting core can and does exceed it."
),
));
add(Entity::new(
"cpu.core.{n}.frequency",
D::Cpu,
K::Measurement,
Some(U::Megahertz),
// Declared as the weakest provenance any platform's rows can
// carry, which is what `a_reading_never_resolves_weaker_than_ // its_entity_declares` asks for. Linux reads
// `scaling_cur_freq` and over-delivers `Measured`; Windows has
// no unprivileged API for a current clock and multiplies the
// rated maximum by the kernel's delivered-performance counter,
// which is a derivation and says so.
P::Derived,
true,
concat!(
"Current core clock. Null when the platform reports no ",
"per-core clock. Each reading carries its own provenance: ",
"Linux measures it from `scaling_cur_freq`, Windows derives ",
"it from the rated maximum and `% Processor Performance`."
),
)
.derived(&["cpu.core.{n}.frequency.max"]));
add(Entity::new(
"cpu.core.{n}.frequency.min",
D::Cpu,
K::Limit,
Some(U::Megahertz),
P::Unavailable,
true,
"Minimum core clock. Unavailable on Windows, which exposes no such \
figure; it is not inferable from the maximum.",
));
// ── GPU ──────────────────────────────────────────────────────────────
add(Entity::new(
"gpu.{n}.name",
D::Gpu,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Adapter name as the driver reports it.",
));
add(Entity::new(
"gpu.{n}.vendor",
D::Gpu,
K::Identity,
Some(U::Identifier),
P::Measured,
false,
"One of nvidia, amd, intel, apple.",
));
add(Entity::new(
"gpu.{n}.utilization",
D::Gpu,
K::Measurement,
Some(U::Percent),
P::Measured,
true,
"Graphics engine busy percentage.",
));
add(Entity::new(
"gpu.{n}.memory.used",
D::Gpu,
K::Measurement,
Some(U::Bytes),
P::Measured,
true,
concat!(
"Video memory in use, including what the driver reserves for itself ",
"-- about 250 MB on an RTX 3090 Ti -- so an idle discrete card does ",
"not read zero. Recent `nvidia-smi` excludes the reservation, and ",
"reads lower by that much. Null on unified-memory parts that report none."
),
));
add(Entity::new(
"gpu.{n}.memory.total",
D::Gpu,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Total video memory.",
));
add(Entity::new(
"gpu.{n}.thermal.temperature",
D::Gpu,
K::Measurement,
Some(U::Celsius),
P::Measured,
true,
"GPU core temperature. Null where no sensor is exposed — notably Apple \
Silicon via powermetrics. Null is not zero degrees.",
));
add(Entity::new(
"gpu.{n}.thermal.max_temperature",
D::Gpu,
K::Limit,
Some(U::Celsius),
P::Measured,
true,
"Vendor-declared thermal limit, read from the driver. Null when the \
vendor publishes none — it must not be filled with a plausible constant.",
));
add(Entity::new(
"gpu.{n}.thermal.critical_temperature",
D::Gpu,
K::Limit,
Some(U::Celsius),
P::Measured,
true,
"Vendor-declared shutdown threshold, read from the driver. Null when \
unpublished.",
));
add(Entity::new(
"gpu.{n}.power.draw",
D::Gpu,
K::Measurement,
Some(U::Milliwatts),
P::Measured,
true,
"Instantaneous board power draw.",
));
add(Entity::new(
"gpu.{n}.power.limit",
D::Gpu,
K::Limit,
Some(U::Milliwatts),
P::Measured,
true,
"Enforced power cap. Null when the driver exposes none; a percentage of \
an unknown cap is not a measurement and is reported null in turn.",
));
add(Entity::new(
"gpu.{n}.clocks.graphics",
D::Gpu,
K::Measurement,
Some(U::Megahertz),
P::Measured,
true,
"Current graphics clock.",
));
add(Entity::new(
"gpu.{n}.clocks.graphics.max",
D::Gpu,
K::Limit,
Some(U::Megahertz),
P::Measured,
true,
"Maximum graphics clock as the driver declares it. Null where the vendor \
publishes no ceiling.",
));
// ── Memory ───────────────────────────────────────────────────────────
add(Entity::new(
"memory.total",
D::Memory,
K::Identity,
Some(U::Bytes),
P::Measured,
false,
"Total installed RAM visible to the OS.",
));
add(Entity::new(
"memory.used",
D::Memory,
K::Measurement,
Some(U::Bytes),
P::Measured,
false,
"RAM currently in use.",
));
add(Entity::new(
"memory.utilization",
D::Memory,
K::Measurement,
Some(U::Percent),
P::Measured,
// Nullable: with total memory reported as zero the percentage
// has no denominator, and the resolver says so.
true,
"Used RAM as a percentage of total.",
)
.derived(&["memory.used", "memory.total"]));
add(Entity::new(
"memory.swap.total",
D::Memory,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Total swap or pagefile capacity.",
));
add(Entity::new(
"memory.swap.used",
D::Memory,
K::Measurement,
Some(U::Bytes),
P::Measured,
true,
"Swap or pagefile currently in use.",
));
add(Entity::new(
"cpu.cache.l1d",
D::Cpu,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Total L1 data cache across all cores. Reported in bytes, though the \
platform sources state it in KiB, so that every capacity in this \
ontology carries the same unit.",
));
add(Entity::new(
"cpu.cache.l1i",
D::Cpu,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Total L1 instruction cache across all cores.",
));
add(Entity::new(
"cpu.cache.l2",
D::Cpu,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Total L2 cache.",
));
add(Entity::new(
"cpu.cache.l3",
D::Cpu,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Total L3 cache. Null on parts with no last-level cache to report.",
));
add(Entity::new(
"cpu.cache.{n}.level",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Cache level of one cache instance — l1, l2, l3, l4.",
));
add(Entity::new(
"cpu.cache.{n}.size",
D::Cpu,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Size of one cache instance.",
));
add(Entity::new(
"cpu.cache.{n}.line_size",
D::Cpu,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Cache line size. The unit of false sharing, and the reason this is \
exposed per instance rather than assumed to be 64 bytes.",
));
add(Entity::new(
"cpu.cache.{n}.shared_cpus",
D::Cpu,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Which logical processors share this cache, as a range list. Null where \
the platform does not publish the sharing map.",
));
// ── Microarchitecture and instruction set ────────────────────────────
//
// CPUID and its equivalents, which is the processor describing itself.
// `Specification` rather than `Measured` for that reason: these values
// do not change while the machine runs, and ironmon read a declaration
// rather than sampling anything.
//
// The reader also computes a `single_thread_score` and a matching
// multi-thread figure, both 0-100, and neither is published here. They
// come from a lookup table over microarchitecture names, not from any
// measurement of this processor, and an agent choosing between machines
// on a number called a performance score would be relying on a guess
// with a benchmark's authority. The extension list below is the part of
// that reader an agent can actually act on: whether AVX-512 is present
// is a fact, and it is the fact that decides a kernel.
add(Entity::new(
"cpu.microarch.<none>",
D::Cpu,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when the processor could not be identified, carrying why.",
));
add(Entity::new(
"cpu.microarch.name",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Microarchitecture as ironmon recognises it - Zen 5, Golden Cove, \
Firestorm. Distinct from `cpu.model`, which is the marketing \
string: processors with different model names share a \
microarchitecture, and it is the microarchitecture that decides \
which instructions are fast.",
));
add(Entity::new(
"cpu.microarch.codename",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
true,
"Vendor code name for this silicon - Granite Ridge, Raptor Lake-S. \
Nullable: IronMonitor does not hold one for every part it can name.",
));
add(Entity::new(
"cpu.microarch.vendor",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Who made the processor.",
));
add(Entity::new(
"cpu.microarch.isa",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Instruction set architecture - x86_64, aarch64, riscv64. The coarsest \
compatibility question there is, and the first one a consumer \
selecting a binary has to answer.",
));
add(Entity::new(
"cpu.microarch.process",
D::Cpu,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Manufacturing process node in nanometres. A marketing figure as much \
as a physical one across vendors, so it is comparable within a \
vendor and not between them. Nullable where IronMonitor holds none.",
));
add(Entity::new(
"cpu.microarch.year",
D::Cpu,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Year this microarchitecture was introduced. From ironmon's own table \
rather than from the silicon - it is the age of the design, not of \
this chip. Nullable where IronMonitor holds no date.",
));
add(Entity::new(
"cpu.microarch.hybrid",
D::Cpu,
K::Identity,
None,
P::Specification,
false,
"Whether the design mixes performance and efficiency cores. True means \
the per-core figures elsewhere are not comparable to each other, \
which is worth knowing before averaging any of them.",
));
add(Entity::new(
"cpu.microarch.family",
D::Cpu,
K::Identity,
Some(U::Count),
P::Specification,
true,
"CPUID family. Reported alongside model and stepping because the three \
together identify the silicon exactly, which the name does not. \
Nullable because Windows never decodes the triple, and all three go \
together or not at all: publishing a stepping beside an absent family \
would present a default as a measurement.",
));
add(Entity::new(
"cpu.microarch.model",
D::Cpu,
K::Identity,
Some(U::Count),
P::Specification,
true,
"CPUID model number within the family. Nullable with family and \
stepping, which it is only meaningful beside.",
));
add(Entity::new(
"cpu.microarch.stepping",
D::Cpu,
K::Identity,
Some(U::Count),
P::Specification,
true,
"CPUID stepping - the revision of this particular silicon. Errata are \
published against steppings, so a consumer checking for one needs \
this and not the model name. Nullable with family and model; a \
stepping of 0 is a legitimate value, which is why it is withheld \
rather than defaulted when the triple was not read.",
));
add(Entity::new(
"cpu.microarch.physical_cores",
D::Cpu,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Physical core count. Below `logical_cores` when SMT is on, and the \
right denominator for anything that scales with execution \
resources rather than with schedulable threads.",
));
add(Entity::new(
"cpu.microarch.logical_cores",
D::Cpu,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Logical processor count, SMT threads included. The right denominator \
for a thread pool.",
));
add(Entity::new(
"cpu.microarch.smt_enabled",
D::Cpu,
K::Identity,
None,
P::Measured,
true,
"Whether simultaneous multithreading is on right now. Measured rather \
than declared: the silicon supports it or does not, but firmware \
and the kernel both get a say, and this is the state as found.",
));
add(Entity::new(
"cpu.microarch.extension.<none>",
D::Cpu,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no instruction set extension was enumerated, carrying \
why. An empty list is never the answer: every processor ironmon runs \
on supports something, so nothing enumerated means the reader \
failed rather than that the CPU is bare.",
));
add(Entity::new(
"cpu.microarch.extension.{n}.name",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Extension the processor reports as present - AVX-512, AES-NI, SVE. \
The list holds only supported extensions, so membership is the \
claim and there is no `supported` flag to check.",
));
add(Entity::new(
"cpu.microarch.extension.{n}.category",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"What the extension is for - vector arithmetic, cryptography, atomics.",
));
add(Entity::new(
"cpu.microarch.extension.{n}.description",
D::Cpu,
K::Identity,
Some(U::Text),
P::Specification,
false,
"A sentence on what the extension does. ironmon's own text rather than \
the vendor's, and it is there so an agent that has not met an \
extension can still tell whether it matters to the task at hand.",
));
// ── Cryptographic acceleration ───────────────────────────────────────
//
// Which crypto primitives this processor implements in hardware. The
// reader's `acceleration_score` and its free-text recommendations are
// left out for the same reason the performance scores above are: a
// score compresses a set of facts into a number whose scale nothing
// documents, and an agent is better served by the facts.
//
// Throughput estimates are published, and as `Derived`. They come from
// per-primitive constants rather than from running anything on this
// machine, so they are a calculation and are labelled as one.
add(Entity::new(
"cpu.crypto.<none>",
D::Cpu,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no hardware crypto feature was enumerated, carrying why.",
));
add(Entity::new(
"cpu.crypto.feature.{n}.name",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Hardware-accelerated primitive - AES-NI, SHA extensions, carry-less \
multiply. Only accelerated primitives appear; a primitive absent \
from this list runs in software.",
));
add(Entity::new(
"cpu.crypto.feature.{n}.flag",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"The CPU flag that reports it, as the platform spells it. Included so a consumer can match against the flag names it already has rather than against the naming ironmon chose.",
));
add(Entity::new(
"cpu.crypto.feature.{n}.category",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Primitive class - symmetric cipher, hash, public key, random.",
));
add(Entity::new(
"cpu.crypto.feature.{n}.throughput",
D::Cpu,
K::Limit,
Some(U::BytesPerSecond),
P::Derived,
true,
"Estimated per-core throughput for this primitive. A constant scaled \
to bytes, not a measurement of this processor: a consumer sizing a \
pipeline from it is reading a rule of thumb. Nullable, because \
IronMonitor holds no estimate for every primitive.",
)
.derived(&["cpu.crypto.feature.{n}.name"]));
add(Entity::new(
"cpu.crypto.rng.<none>",
D::Cpu,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no hardware random source was found, carrying why. Worth \
its own diagnostic: a machine with no hardware RNG is a real and \
consequential state, and it must not look like a failed read.",
));
add(Entity::new(
"cpu.crypto.rng.{n}.name",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Hardware random source the platform reports as available - RDRAND, \
RDSEED, a TPM. Unavailable sources are omitted rather than listed \
as present-but-off.",
));
add(Entity::new(
"cpu.crypto.rng.{n}.source",
D::Cpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Where the entropy comes from - a CPU instruction, a discrete chip, \
the kernel pool. The distinction matters: a CPU instruction and a \
TPM fail in different ways and are trusted differently.",
));
add(Entity::new(
"cpu.crypto.rng.{n}.quality",
D::Cpu,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Entropy bits per sample, where the source declares a figure. Nullable \
and usually null - most sources state nothing, and an assumed \
number here would be worse than silence.",
));
// ── Memory modules ───────────────────────────────────────────────────
//
// Everything here comes from the SMBIOS type-17 tables, which the board
// fills in at POST. Until 6.0.0 the whole cluster was declared
// `Measured`, which claimed IronMonitor had sampled a part number off the
// module -- it had not; it read a table the firmware wrote. A board that
// lies about its own DIMMs makes ironmon repeat the lie, and a consumer
// deciding whether to trust one of these figures needs to know that
// before it decides. `ecc` stays `Derived`: it is a comparison of two of
// the fields below rather than a field of its own.
//
// Serial numbers are readable here and deliberately left out. They
// identify the individual module rather than describe it, no agent task
// needs one, and a hardware report carrying them is harder to share.
add(Entity::new(
"memory.dimm.{n}.locator",
D::Memory,
K::Identity,
Some(U::Text),
P::Specification,
true,
"Slot label as silkscreened on the board — DIMM_A1, ChannelA-DIMM0. \
The id index is enumeration order; this is what a human replacing the \
module needs.",
));
add(Entity::new(
"memory.dimm.{n}.populated",
D::Memory,
K::Identity,
None,
P::Specification,
true,
"Whether this slot holds a module. False is a reading, and the reason \
the fields below may be absent for a slot that genuinely exists. Null \
where nothing the platform reported establishes presence either way: \
an unreadable size is not an empty slot.",
));
add(Entity::new(
"memory.dimm.{n}.capacity",
D::Memory,
K::Identity,
Some(U::Bytes),
P::Specification,
true,
"Module capacity. Null for an empty slot rather than zero, since zero \
would read as a module of no size.",
));
add(Entity::new(
"memory.dimm.{n}.speed",
D::Memory,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Rated speed in MT/s. Counted rather than given a frequency unit \
because megatransfers are not megahertz — DDR transfers twice per \
clock, and conflating them halves or doubles every figure.",
));
add(Entity::new(
"memory.dimm.{n}.configured_speed",
D::Memory,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Speed the module is actually running at, in MT/s. Differs from the \
rated speed whenever the board declined to train at the module's \
profile, which is the useful thing to notice.",
));
add(Entity::new(
"memory.dimm.{n}.type",
D::Memory,
K::Identity,
Some(U::Identifier),
P::Specification,
true,
"Memory technology — ddr4, ddr5, lpddr5.",
));
add(Entity::new(
"memory.dimm.{n}.manufacturer",
D::Memory,
K::Identity,
Some(U::Text),
P::Specification,
true,
"Module manufacturer from SPD.",
));
add(Entity::new(
"memory.dimm.{n}.part_number",
D::Memory,
K::Identity,
Some(U::Text),
P::Specification,
true,
"Module part number from SPD.",
));
add(Entity::new(
"memory.dimm.{n}.ecc",
D::Memory,
K::Identity,
None,
P::Derived,
true,
"Whether the module carries ECC, from the total data width exceeding \
the usable width — 72 bits against 64. Derived rather than measured \
because no SMBIOS field states it directly.",
)
.derived(&["memory.dimm.{n}.data_width", "memory.dimm.{n}.total_width"]));
add(Entity::new(
"memory.dimm.{n}.data_width",
D::Memory,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Usable data width in bits.",
));
add(Entity::new(
"memory.dimm.{n}.total_width",
D::Memory,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Total width in bits, including any ECC bits.",
));
add(Entity::new(
"memory.dimm.{n}.voltage",
D::Memory,
K::Identity,
Some(U::Volts),
P::Specification,
true,
"Operating voltage.",
));
// ── Attached peripherals ─────────────────────────────────────────────
//
// Input devices, audio endpoints, cameras and printers, each with its
// own `<none>` row. They share a shape and a reason for existing: an
// agent asked to check whether a machine can join a call needs to know
// whether a camera and a microphone are attached, and the answer "no
// rows" cannot distinguish a headless server from a reader that is not
// implemented on this platform.
//
// Everything here is `Measured`. These are enumerations of what is
// plugged in right now, not declarations the firmware made at boot, and
// a device unplugged between two snapshots really does disappear.
add(Entity::new(
"board.input.<none>",
D::Board,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no input device was enumerated, carrying why. A machine \
with no keyboard is an ordinary server; a machine whose input \
enumeration failed is not, and the two must not look alike.",
));
add(Entity::new(
"board.input.{n}.name",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Device name as the platform reports it.",
));
add(Entity::new(
"board.input.{n}.type",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
false,
"What kind of device this is - keyboard, mouse, touchpad, game \
controller, tablet.",
));
add(Entity::new(
"board.input.{n}.interface",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"How it is attached - USB, Bluetooth, PS/2, internal. Nullable \
because a virtualised input device commonly reports no interface \
the classification recognises - both CI runners resolve it absent \
while bare metal resolves it - and a guess here would name a bus \
the device is not on.",
));
add(Entity::new(
"board.input.{n}.vendor",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Vendor name or numeric id, whichever the platform gave. Nullable: \
many devices report neither.",
));
add(Entity::new(
"board.input.{n}.product",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Product name or numeric id. Nullable for the same reason as vendor.",
));
add(Entity::new(
"board.input.{n}.active",
D::Board,
K::Identity,
None,
P::Measured,
// Nullable since 6.0.0: macOS does not read it. The id is
// built with `format!`, so the static check in
// `entities_with_an_absence_path_are_declared_nullable`
// cannot see this one -- it had to be flipped by hand.
true,
"Whether the platform reports the device as connected and usable. A \
present but inactive device is a different fact from an absent one \
- a Bluetooth keyboard out of range is still enumerated.",
));
add(Entity::new(
"board.audio.<none>",
D::Board,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no audio endpoint was enumerated, carrying why.",
));
add(Entity::new(
"board.audio.{n}.name",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Endpoint name as the platform presents it to a user.",
));
add(Entity::new(
"board.audio.{n}.direction",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
false,
"Whether this endpoint plays, captures, or does both. The only \
classification the platform provides - there is no separate \
headset-or-speaker field, and declaring one would put a question \
in the schema that no reader can answer.",
));
add(Entity::new(
"board.audio.{n}.state",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
// Nullable since 6.0.0: Linux and macOS do not read it at all,
// and Windows reads a status whose unhandled values now resolve
// absent rather than falling through to "active".
true,
concat!(
"Endpoint state as the platform reports it: active, ",
"disabled, unplugged, not present."
),
));
add(Entity::new(
"board.audio.{n}.default",
D::Board,
K::Identity,
None,
P::Measured,
// Nullable since 6.0.0: no platform reads it. The id is built
// with `format!`, so the static nullability check cannot see
// it and this had to be flipped by hand.
true,
"Whether this is the endpoint the system routes to by default.",
));
add(Entity::new(
"board.audio.{n}.volume",
D::Board,
K::Measurement,
Some(U::Percent),
P::Measured,
true,
"Endpoint volume. Nullable: not every endpoint exposes a level, and a \
silent zero would read as muted rather than as unknown.",
));
add(Entity::new(
"board.audio.{n}.muted",
D::Board,
K::Identity,
None,
P::Measured,
true,
"Whether the endpoint is muted. Independent of volume - a muted \
endpoint at 80% is not the same as an unmuted one at zero, and \
only one of the two is fixed by turning it up. Null wherever the \
mixer is not read, which is every platform today.",
));
add(Entity::new(
"board.camera.<none>",
D::Board,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no camera was enumerated, carrying why.",
));
add(Entity::new(
"board.camera.{n}.name",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Camera name as the platform reports it.",
));
add(Entity::new(
"board.camera.{n}.connection",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
false,
"How the camera is attached - USB, MIPI CSI, integrated, network.",
));
add(Entity::new(
"board.camera.{n}.driver",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Driver bound to the device. Nullable where the platform does not say.",
));
add(Entity::new(
"board.camera.{n}.max_width",
D::Board,
K::Limit,
Some(U::Count),
P::Measured,
true,
"Widest frame the device reports supporting, in pixels. Nullable \
rather than zero: a camera that reports no mode list is not a \
camera with a zero-pixel frame.",
));
add(Entity::new(
"board.camera.{n}.max_height",
D::Board,
K::Limit,
Some(U::Count),
P::Measured,
true,
"Tallest frame the device reports supporting, in pixels. Nullable for \
the same reason as the width.",
));
add(Entity::new(
"board.camera.{n}.active",
D::Board,
K::Measurement,
None,
P::Measured,
// Nullable since 6.0.0. It is live on Linux only; Windows can rule
// streaming out but not attribute it, and macOS does not look.
true,
"Whether the camera is streaming right now. The one genuinely live \
field in this cluster, and the reason it is a measurement rather \
than an identity.",
));
// Kernel parameters are split, not subsetted. `name`, `value` and
// `category` are what the platform reported and are published here.
// `is_recommended`, `recommended`, `security_score`, `network_score` and
// `recommendations` are this crate's judgement about what the values
// ought to be, and they are deliberately absent: `ironmon tune`'s standing
// rule is that a proposed value comes from what the system declared,
// never from this crate. An agent reading `security_score` off a
// hardware report would be taking an opinion for a measurement, and the
// ontology is the wrong surface for it.
add(Entity::new(
"system.kernel_param.<none>",
D::System,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no kernel parameter could be read, carrying why. \
Windows reads exactly one — the TCP auto-tuning level — so its \
absence here is common and says nothing about Linux.",
));
add(Entity::new(
"system.kernel_param.{n}.name",
D::System,
K::Identity,
Some(U::Identifier),
P::Measured,
false,
"Parameter name in the platform's own namespace: a sysctl key on \
Linux and macOS, a synthesised dotted name on Windows where the \
setting comes from a cmdlet rather than a key.",
));
add(Entity::new(
"system.kernel_param.{n}.value",
D::System,
K::Measurement,
Some(U::Identifier),
P::Measured,
false,
"The value as the platform reported it, unparsed. A measurement \
rather than an identity because it changes while the machine runs, \
and text rather than a number because sysctl values are not all \
numeric — a list of ports and a boolean live in the same namespace.",
));
add(Entity::new(
"system.kernel_param.{n}.category",
D::System,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Which subsystem the parameter governs — network, memory, security. \
The reader's classification of a real key, not a judgement about \
its value.",
));
// Services are counted, not enumerated. This machine runs 311 of them,
// and one entity per service would more than double every snapshot to
// carry a list nothing reads in full. What a consumer actually asks is
// how many there are, how many are up, and which ones are broken — so
// the failed units are named and the working ones are a number.
add(Entity::new(
"system.service.count.total",
D::System,
K::Measurement,
Some(U::Count),
P::Measured,
false,
"How many services the platform's service manager knows about.",
));
add(Entity::new(
"system.service.count.running",
D::System,
K::Measurement,
Some(U::Count),
P::Measured,
false,
"How many are active right now.",
));
add(Entity::new(
"system.service.count.failed",
D::System,
K::Measurement,
Some(U::Count),
P::Measured,
false,
"How many are in a failed state. Zero is a real and common reading \
here, and distinct from the absence carried by \
`system.service.<none>` — a machine with no failures and a machine \
whose services could not be enumerated must not look alike.",
));
add(Entity::new(
"system.service.failed.{n}",
D::System,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Name of a failed service. The counts above say how much is wrong; \
this says what, which is the part a consumer can act on. Absent \
when nothing has failed.",
));
add(Entity::new(
"system.service.<none>",
D::System,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when the service manager could not be reached, carrying \
why. Distinguishes that from a genuine count of zero.",
));
add(Entity::new(
"system.printer.<none>",
D::System,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no printer was enumerated, carrying why.",
));
add(Entity::new(
"system.printer.{n}.name",
D::System,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Queue name, which is what a print job is addressed to.",
));
add(Entity::new(
"system.printer.{n}.description",
D::System,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Human description or model. Nullable: many queues carry none.",
));
add(Entity::new(
"system.printer.{n}.connection",
D::System,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"How the printer is reached - USB, network, virtual. Nullable because \
the classification is drawn from the port string and the device name, \
and a local printer on a port shape neither recognises is a real \
configuration rather than a failed read.",
));
add(Entity::new(
"system.printer.{n}.status",
D::System,
K::Measurement,
Some(U::Identifier),
P::Measured,
true,
"Queue state as the spooler reports it - idle, printing, stopped, \
error. A measurement, because it changes while the machine runs. \
Nullable because the spooler itself has \"Other\" and \"Unknown\" \
states, and reporting either as a queue state would invent one.",
));
add(Entity::new(
"system.printer.{n}.default",
D::System,
K::Identity,
None,
P::Measured,
false,
"Whether this is the queue a job goes to when none is named.",
));
add(Entity::new(
"system.printer.{n}.accepting_jobs",
D::System,
K::Measurement,
None,
P::Measured,
// Nullable since 6.0.0: only CUPS reports it. The id is built
// with `format!`, so the static nullability check cannot see
// this one either.
true,
"Whether the queue is taking new work. Distinct from `status`: a \
stopped queue may still accept jobs and hold them, which is the \
difference between a delayed print and a rejected one.",
));
add(Entity::new(
"system.printer.{n}.color",
D::System,
K::Identity,
None,
P::Measured,
true,
concat!(
"Whether the device prints in colour, as the driver declares. ",
"Nullable: a spooler that lists no capabilities has not said the ",
"printer is monochrome, and this read `false` for every printer ",
"on Windows until it was taken from `Capabilities` rather than ",
"from a property `Win32_Printer` does not have.",
),
));
// ── Bluetooth radios ─────────────────────────────────────────────────
//
// Adapters only. Paired and nearby devices are readable too and are not
// published here: they are other people's hardware as much as this
// machine's, they change without anything on this machine doing
// anything, and a hardware report that enumerates the phones in the
// room is a different and more sensitive artefact than one that
// describes the computer.
add(Entity::new(
"network.bluetooth.<none>",
D::Network,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no Bluetooth adapter was enumerated, carrying why.",
));
add(Entity::new(
"network.bluetooth.{n}.name",
D::Network,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Adapter name as the platform reports it.",
));
add(Entity::new(
"network.bluetooth.{n}.powered",
D::Network,
K::Measurement,
None,
P::Measured,
true,
"Whether the radio is on. A measurement: it is a runtime state, and it \
is the field that answers whether the adapter is usable now.",
));
// ── Storage controllers ──────────────────────────────────────────────
//
// The controllers the disks hang off, which is a different question
// from the disks themselves. An agent diagnosing throughput needs both:
// four NVMe drives behind one x4 controller do not add up the way four
// drives behind four controllers do, and nothing in `disk.*` says which
// arrangement this machine has.
add(Entity::new(
"disk.controller.<none>",
D::Disk,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no storage controller was enumerated, carrying why.",
));
add(Entity::new(
"disk.controller.{n}.name",
D::Disk,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Controller name as the platform reports it.",
));
add(Entity::new(
"disk.controller.{n}.vendor",
D::Disk,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Controller vendor. Nullable where the platform names none.",
));
add(Entity::new(
"disk.controller.{n}.model",
D::Disk,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Controller model. Nullable for the same reason as the vendor.",
));
add(Entity::new(
"disk.controller.{n}.driver",
D::Disk,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Driver bound to the controller. The field that most often explains a \
performance difference between two otherwise identical machines.",
));
add(Entity::new(
"disk.controller.{n}.interface",
D::Disk,
K::Identity,
Some(U::Identifier),
P::Measured,
false,
"Interface the controller speaks - NVMe, SATA, SAS, USB, RAID.",
));
add(Entity::new(
"disk.controller.{n}.pci_address",
D::Disk,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"PCI address, where the controller sits on a PCI bus. Nullable for \
controllers that do not - a USB bridge has none. Present so a \
consumer can join this against `pci.*` and find the link width.",
));
add(Entity::new(
"disk.controller.{n}.ports",
D::Disk,
K::Limit,
Some(U::Count),
P::Measured,
true,
"Port count the controller reports. Nullable rather than zero: a \
controller that reports no count still has ports.",
));
// ── Power profiles ───────────────────────────────────────────────────
//
// Which power plans the operating system offers and which one is in
// force. A setting in every sense -- it is writable, and it changes
// every frequency and power figure elsewhere in this snapshot -- but it
// is declared as an identity here because the ontology's `Setting` kind
// is bound to the apply layer, and IronMonitor does not yet write these.
// Declaring it writable when nothing can write it would be the same
// overclaim in a different field.
add(Entity::new(
"power.profile.<none>",
D::Power,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no power plan was enumerated, carrying why.",
));
add(Entity::new(
"power.profile.{n}.name",
D::Power,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Plan name as the operating system presents it - Balanced, High \
performance, Power saver.",
));
add(Entity::new(
"power.profile.{n}.active",
D::Power,
K::Measurement,
None,
P::Measured,
false,
"Whether this plan is the one in force. Exactly one plan should carry \
true; a snapshot where none does means the active plan was not \
identified rather than that the machine is running unmanaged.",
));
// ── Video codec engines ──────────────────────────────────────────────
//
// What the GPU can encode and decode in hardware. This cluster is the
// clearest case in the whole ontology for per-reading provenance: the
// underlying reader records how it learned each capability, and the two
// answers are not equally good. A capability the driver was asked about
// directly is `Measured`; one concluded from the GPU model is `Derived`,
// and it is wrong exactly as often as the lookup table is out of date.
// Both are published, and which is which is never hidden.
add(Entity::new(
"gpu.codec.<none>",
D::Gpu,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no hardware codec capability was found, carrying why. A \
GPU with no media engine is a real configuration - many datacentre \
parts ship without one - and it must not look like a failed probe.",
));
add(Entity::new(
"gpu.codec.{n}.device",
D::Gpu,
K::Identity,
Some(U::Text),
P::Specification,
false,
"The GPU this capability belongs to. Present on every row because a \
machine with two GPUs has two independent sets of engines. Declared \
at the weakest provenance a row can carry: a queried row resolves \
Measured, an inferred one Specification, and a schema that promised \
Measured for both would overstate half of them.",
));
add(Entity::new(
"gpu.codec.{n}.codec",
D::Gpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Codec - H.264, HEVC, AV1, VP9. Measured on a queried row; declared \
here at the weaker provenance an inferred row carries.",
));
add(Entity::new(
"gpu.codec.{n}.direction",
D::Gpu,
K::Identity,
Some(U::Identifier),
P::Specification,
false,
"Whether the engine encodes, decodes, or both. Asymmetry is normal: \
AV1 decode is common on hardware that cannot encode it. Measured on \
a queried row; declared at the weaker provenance an inferred row \
carries.",
));
add(Entity::new(
"gpu.codec.{n}.engine",
D::Gpu,
K::Identity,
Some(U::Identifier),
P::Specification,
true,
"Vendor name for the engine - NVENC, NVDEC, QuickSync, VCN. Nullable \
where the capability was inferred rather than queried, since an \
inference names no engine. Measured on a queried row; declared at \
the weaker provenance an inferred row carries.",
));
add(Entity::new(
"gpu.codec.{n}.max_resolution",
D::Gpu,
K::Limit,
Some(U::Identifier),
P::Specification,
false,
"Largest frame class this engine handles, as the reader classifies it - hd, full_hd, qhd, uhd_4k, uhd_8k. A class rather than a pixel count because that is what the underlying source provides. Measured on a queried row; declared at the weaker provenance an inferred row carries.",
));
add(Entity::new(
"gpu.codec.{n}.max_width",
D::Gpu,
K::Limit,
Some(U::Count),
P::Derived,
true,
"Width in pixels of the frame class above. Derived, and the derivation is a table: uhd_4k means 3840 here. An engine whose real limit sits between two classes will be described by the lower one, so this is a floor rather than a measured ceiling.",
)
.derived(&["gpu.codec.{n}.max_resolution"]));
add(Entity::new(
"gpu.codec.{n}.max_height",
D::Gpu,
K::Limit,
Some(U::Count),
P::Derived,
true,
"Height in pixels of the frame class above, from the same table and with the same caveat.",
)
.derived(&["gpu.codec.{n}.max_resolution"]));
add(Entity::new(
"gpu.codec.{n}.max_bit_depth",
D::Gpu,
K::Limit,
Some(U::Count),
P::Specification,
true,
"Bit depth per channel the engine supports. Eight against ten is the \
difference between HDR working and not. Measured on a queried row; \
declared at the weaker provenance an inferred row carries, like the \
rest of this cluster.",
));
add(Entity::new(
"gpu.codec.{n}.max_fps",
D::Gpu,
K::Limit,
Some(U::Count),
// Declared `Unavailable`, not `Derived`: a `Derived` entity has
// to name the inputs it is computed from, and this one named two
// it never read.
P::Unavailable,
true,
concat!(
"Frames per second at the maximum resolution. No driver ",
"reports a frame rate and this crate does not compute one, ",
"so this always resolves absent. The description here used ",
"to say the figure was arithmetic over the engine ",
"generation, and the entity declared inputs to match; the ",
"reader held a literal 60 at every construction site."
),
));
add(Entity::new(
"gpu.codec.{n}.confidence",
D::Gpu,
K::Identity,
Some(U::Percent),
P::Derived,
false,
"How sure the reader is of this row, as a percentage. Full confidence \
means the driver was asked; anything less means the capability was \
concluded from the GPU model. Published alongside the reading's \
own provenance rather than instead of it: the provenance says what \
kind of claim this is and the confidence says how strong.",
)
.derived(&["gpu.codec.{n}.codec", "gpu.codec.{n}.device"]));
// ── Virtualization ───────────────────────────────────────────────────
add(Entity::new(
"system.virtualization.platform",
D::System,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Whether this is bare metal, a virtual machine, or a container. The \
first thing an agent needs before trusting any other reading: a \
guest's view of its own hardware is the hypervisor's choice, not the \
silicon's.",
));
add(Entity::new(
"system.virtualization.hypervisor",
D::System,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
concat!(
"Which hypervisor is present, when one was detected. ",
"A value here does not mean this machine is a guest. ",
"Windows 11 enables virtualization-based security by default, ",
"which puts the host itself under a thin hypervisor, so an ",
"ordinary desktop reports `hyperv` while ",
"`system.virtualization.platform` correctly reports ",
"`bare_metal` -- both rows are true at once, and the machine ",
"this was found on is one of them. Read `platform` for the ",
"question \"am I in a VM\": `detect.rs` answers it from the ",
"Hyper-V privilege leaf rather than the CPUID vendor string, ",
"which is identical either side of the partition boundary. ",
"Null means no hypervisor was detected at all."
),
));
add(Entity::new(
"system.virtualization.detection_method",
D::System,
K::Identity,
Some(U::Text),
P::Measured,
true,
"How the platform was determined — CPUID leaf, DMI string, kernel \
file. Recorded because virtualization detection is inference, and an \
agent weighing it should see what it rests on.",
));
add(Entity::new(
"system.virtualization.hardware_support",
D::System,
K::Identity,
None,
P::Measured,
true,
"Whether the CPU exposes hardware virtualization (VT-x or AMD-V). \
Independent of whether this machine is itself virtualized.",
));
// ── NUMA ─────────────────────────────────────────────────────────────
add(Entity::new(
"memory.numa.nodes",
D::Memory,
K::Identity,
Some(U::Count),
P::Measured,
true,
"Number of NUMA nodes. One means uniform memory access, which is a \
reading and not an absence.",
));
add(Entity::new(
"memory.numa.is_numa",
D::Memory,
K::Identity,
None,
P::Measured,
true,
"Whether memory access is genuinely non-uniform. A single-node machine \
reports false; a machine the reader could not inspect reports nothing.",
));
add(Entity::new(
"memory.numa.{n}.cpus",
D::Memory,
K::Identity,
Some(U::Count),
P::Measured,
true,
"Logical processors belonging to this NUMA node.",
));
add(Entity::new(
"memory.numa.{n}.memory",
D::Memory,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Memory attached to this NUMA node.",
));
// ── ECC ──────────────────────────────────────────────────────────────
add(Entity::new(
"memory.ecc.active",
D::Memory,
K::Identity,
None,
P::Measured,
true,
"Whether ECC is enabled and reporting. Distinct from whether the \
modules carry ECC bits — see the per-slot `ecc` entity — because \
hardware capable of correction that is not reporting corrections is \
indistinguishable from hardware doing nothing.",
));
add(Entity::new(
"memory.ecc.correctable_errors",
D::Memory,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Corrected memory errors since boot. Zero is a reading and a good one; \
a rising count is the earliest warning a DIMM gives.",
));
add(Entity::new(
"memory.ecc.uncorrectable_errors",
D::Memory,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Uncorrectable memory errors since boot. Any non-zero value means data \
was lost.",
));
// ── PCI ──────────────────────────────────────────────────────────────
add(Entity::new(
"pci.{addr}.vendor",
D::Pci,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Vendor name. The id segment is the BDF address — domain, bus, device \
and function — with separators replaced, so it is the same identifier \
`lspci` prints and is stable across reboots.",
));
add(Entity::new(
"pci.{addr}.device",
D::Pci,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Device name as the vendor and device id pair decodes to.",
));
add(Entity::new(
"pci.{addr}.class",
D::Pci,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Decoded PCI class — what kind of device this is.",
));
add(Entity::new(
"pci.{addr}.driver",
D::Pci,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Driver bound to the device. Null when none is, which is the \
interesting case: an unclaimed device is a device that does not work.",
));
add(Entity::new(
"pci.{addr}.link.width",
D::Pci,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Negotiated PCIe link width — x1, x4, x16. Unavailable on Windows, \
which exposes no link state through the interfaces IronMonitor uses.",
));
add(Entity::new(
"pci.{addr}.link.max_width",
D::Pci,
K::Limit,
Some(U::Identifier),
P::Measured,
true,
"Maximum width the device supports. Compare against the negotiated \
width: a x16 card trained at x4 is the classic silent performance \
fault this pair exists to expose.",
));
add(Entity::new(
"pci.{addr}.link.speed",
D::Pci,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Negotiated link speed, as the transfer rate the device reports — \
8.0 GT/s, 16.0 GT/s.",
));
add(Entity::new(
"pci.{addr}.link.max_speed",
D::Pci,
K::Limit,
Some(U::Identifier),
P::Measured,
true,
"Maximum link speed the device supports.",
));
add(Entity::new(
"pci.{addr}.numa_node",
D::Pci,
K::Identity,
Some(U::Count),
P::Measured,
true,
"NUMA node this device is attached to. Null on machines with no NUMA \
affinity to report — the reader's -1 sentinel is not a node number.",
));
// ── USB ──────────────────────────────────────────────────────────────
add(Entity::new(
"usb.{addr}.product",
D::Usb,
K::Identity,
Some(U::Text),
P::Measured,
true,
concat!(
"Product string as the device reports it. The id segment is ",
"the platform's own device path -- the sysfs name on Linux, ",
"the PnP instance path on Windows, the Location ID on ",
"macOS -- normalised into one segment. It is unique per ",
"device and changes only when that device moves or is ",
"replaced, so unplugging one device does not repoint the ",
"ids of the others."
),
));
add(Entity::new(
"usb.{addr}.manufacturer",
D::Usb,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Manufacturer string. Null on devices that publish none.",
));
add(Entity::new(
"usb.{addr}.vendor_id",
D::Usb,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"USB vendor id, four hex digits.",
));
add(Entity::new(
"usb.{addr}.product_id",
D::Usb,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"USB product id, four hex digits.",
));
add(Entity::new(
"usb.{addr}.class",
D::Usb,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Device class — hid, mass_storage, hub, and so on.",
));
add(Entity::new(
"usb.{addr}.speed",
D::Usb,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Negotiated bus speed — low, full, high, super. A super-speed device \
on a high-speed port reports high, which is how a wrong cable shows.",
));
// ── Disk ─────────────────────────────────────────────────────────────
add(Entity::new(
"disk.{n}.model",
D::Disk,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Drive model string from the device.",
));
add(Entity::new(
"disk.{n}.capacity",
D::Disk,
K::Identity,
Some(U::Bytes),
P::Measured,
true,
"Raw device capacity, before any partitioning. Nullable because a \
device can genuinely decline to report one — a USB mass-storage \
gadget with no medium presents as a drive of unstated size, and zero \
would claim it holds nothing.",
));
add(Entity::new(
"disk.{n}.read_rate",
D::Disk,
K::Measurement,
Some(U::BytesPerSecond),
P::Measured,
true,
concat!(
"Read throughput. Null in a single-shot snapshot, because a ",
"rate needs two samples to difference and this resolver takes ",
"one. Not a platform limitation: Windows exposes ",
"`DiskReadBytesPerSec` and Linux `/sys/block/*/stat` gives ",
"read and write sectors separately, so a caller that samples ",
"twice can compute it per direction."
),
));
add(Entity::new(
"disk.{n}.write_rate",
D::Disk,
K::Measurement,
Some(U::BytesPerSecond),
P::Measured,
true,
concat!(
"Write throughput. Null in a single-shot snapshot, because a ",
"rate needs two samples to difference and this resolver takes ",
"one. Not a platform limitation: Windows exposes ",
"`DiskWriteBytesPerSec` and Linux `/sys/block/*/stat` gives ",
"read and write sectors separately, so a caller that samples ",
"twice can compute it per direction."
),
));
add(Entity::new(
"disk.{n}.partition.{m}.mount_point",
D::Disk,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Mount point of a partition that genuinely resides on this device. A \
device holding no mounted volume reports none rather than every volume \
on the system.",
));
add(Entity::new(
"disk.{n}.serial",
D::Disk,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Drive serial number. Null where the platform will not disclose it \
without elevation.",
));
add(Entity::new(
"disk.{n}.kind",
D::Disk,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Transport and medium — nvme_ssd, sata_ssd, sata_hdd, and so on. \
Distinct from the SMART media type, which describes the medium alone.",
));
add(Entity::new(
"disk.{n}.health",
D::Disk,
K::Measurement,
Some(U::Text),
P::Measured,
true,
"Health verdict — healthy, warning, critical, failed, unknown. Derived \
from the drive's own report, never from the device merely existing. \
`unknown` is a real answer and means no counter could be read.",
));
add(Entity::new(
"disk.{n}.temperature",
D::Disk,
K::Measurement,
Some(U::Celsius),
P::Measured,
true,
"Drive temperature, from the NVMe health log or ATA attribute 194. \
Null on devices that expose no thermal sensor.",
));
add(Entity::new(
"disk.{n}.smart.passed",
D::Disk,
K::Measurement,
None,
P::Measured,
true,
"The drive's own pass/fail verdict on itself — NVMe critical warning \
bits, or the ATA failure prediction. Not a judgement computed from the \
counters below.",
));
add(Entity::new(
"disk.{n}.smart.power_on_hours",
D::Disk,
K::Measurement,
Some(U::Hours),
P::Measured,
true,
"Lifetime powered-on hours. A minority of ATA drives report this \
attribute in minutes and nothing in the structure distinguishes them.",
));
add(Entity::new(
"disk.{n}.smart.power_cycles",
D::Disk,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Lifetime power cycle count.",
));
add(Entity::new(
"disk.{n}.smart.reallocated_sectors",
D::Disk,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Sectors the drive has remapped. Null on NVMe, which has no sector \
reallocation concept — that is an ATA notion, and zero would assert a \
clean count that was never measured.",
));
add(Entity::new(
"disk.{n}.smart.pending_sectors",
D::Disk,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Sectors awaiting remap — data at risk now. Null on NVMe, for the same \
reason as the reallocated count.",
));
add(Entity::new(
"disk.{n}.smart.uncorrectable_sectors",
D::Disk,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Uncorrectable sectors on ATA; media errors on NVMe.",
));
add(Entity::new(
"disk.{n}.nvme.version",
D::Disk,
K::Identity,
Some(U::Text),
P::Measured,
true,
"NVMe specification version the controller reports. Null on non-NVMe.",
));
add(Entity::new(
"disk.{n}.nvme.percentage_used",
D::Disk,
K::Measurement,
Some(U::Percent),
P::Measured,
true,
"Share of rated write endurance consumed. May legitimately exceed 100 \
on a drive past its rating, which is a reading and not an error.",
));
add(Entity::new(
"disk.{n}.nvme.data_units_written",
D::Disk,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Lifetime data units written, in 1000x512-byte units as NVMe defines \
them. Reported in the drive's own unit rather than converted, so that \
the number matches what other NVMe tools show.",
));
add(Entity::new(
"disk.{n}.nvme.data_units_read",
D::Disk,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Lifetime data units read, in the same units as the written count.",
));
add(Entity::new(
"disk.{n}.nvme.power_state",
D::Disk,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"Current NVMe power state index. State 0 is both the active state and \
what an unread field would look like, so this is null unless the \
controller answered Get Features.",
));
add(Entity::new(
"disk.{n}.nvme.critical_warnings",
D::Disk,
K::Measurement,
Some(U::Count),
P::Measured,
true,
"NVMe critical warning bitfield. Zero is a reading — a drive with \
nothing wrong — and is reported as such rather than omitted.",
));
// ── Network ──────────────────────────────────────────────────────────
add(Entity::new(
"network.{iface}.rx_rate",
D::Network,
K::Measurement,
Some(U::BytesPerSecond),
P::Measured,
true,
"Receive throughput on this interface.",
));
add(Entity::new(
"network.{iface}.tx_rate",
D::Network,
K::Measurement,
Some(U::BytesPerSecond),
P::Measured,
true,
"Transmit throughput on this interface.",
));
// Cumulative counters exist because a rate does not: a single-shot query has
// one sample, and a rate needs two. Declaring only `rx_rate` forced a
// resolver to either return nothing useful or to pass a counter off as a
// rate. These are what a one-shot read can honestly produce.
add(Entity::new(
"network.{iface}.rx_bytes",
D::Network,
K::Measurement,
Some(U::Bytes),
P::Measured,
true,
"Bytes received since the interface came up. A counter, not a rate — \
differentiate two samples to obtain throughput.",
));
add(Entity::new(
"network.{iface}.tx_bytes",
D::Network,
K::Measurement,
Some(U::Bytes),
P::Measured,
true,
"Bytes transmitted since the interface came up. A counter, not a rate.",
));
add(Entity::new(
"network.{iface}.link_speed",
D::Network,
K::Limit,
Some(U::Count),
P::Measured,
true,
"Negotiated link rate in megabits per second, read from the driver. \
Platforms that can only guess from the interface name report this as \
specification-provenance instead.",
));
// ── Power and thermal ────────────────────────────────────────────────
add(Entity::new(
"power.battery.percentage",
D::Power,
K::Measurement,
Some(U::Percent),
P::Measured,
true,
"Battery charge. Null on machines with no battery.",
));
add(Entity::new(
"thermal.{sensor}.temperature",
D::Thermal,
K::Measurement,
Some(U::Celsius),
P::Measured,
true,
"A named board or package temperature sensor.",
));
add(Entity::new(
"thermal.{sensor}.fan_rpm",
D::Thermal,
K::Measurement,
Some(U::Rpm),
P::Measured,
true,
"Fan speed. Null where no tachometer is wired.",
));
// ── Process ──────────────────────────────────────────────────────────
add(Entity::new(
"process.{pid}.name",
D::Process,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Executable name.",
));
add(Entity::new(
"process.{pid}.cpu",
D::Process,
K::Measurement,
Some(U::Percent),
P::Measured,
true,
"Process CPU share over an interval of about 250 ms between two \
samples taken for this snapshot, as a share of all logical \
processors. A process that started within the interval reports \
its average since it started.",
));
add(Entity::new(
"process.{pid}.memory",
D::Process,
K::Measurement,
Some(U::Bytes),
P::Measured,
true,
"Process resident memory.",
));
// ── Displays ─────────────────────────────────────────────────────────
//
// Not in the plan's named list, which was the plan's own list rather
// than an audit: `display` has a reader that answers on every desktop
// and had no schema at all. Around 28 modules are still in that state;
// see the plan section.
add(Entity::new(
"board.display.<none>",
D::Board,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no display was enumerated, carrying why. A headless server reporting none is a reading; a failed query is not.",
));
add(Entity::new(
"board.display.{n}.name",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Display name as the platform reports it. Nullable: a monitor that publishes no EDID name genuinely has none to report.",
));
add(Entity::new(
"board.display.{n}.connection",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"How the display is attached - hdmi, displayport, edp, internal. Nullable, and measured to be so: two of the three displays on the development machine report a connection the reader cannot classify, and it says `unknown`, which the resolver turns into an absence rather than an identifier reading `unknown`.",
));
add(Entity::new(
"board.display.{n}.width",
D::Board,
K::Identity,
Some(U::Count),
P::Measured,
true,
concat!(
"Horizontal resolution in pixels, at the mode currently set. Nullable: ",
"an attached display whose mode is unreadable has no resolution to ",
"report, and zero is not one.",
),
));
add(Entity::new(
"board.display.{n}.height",
D::Board,
K::Identity,
Some(U::Count),
P::Measured,
true,
"Vertical resolution in pixels, at the mode currently set.",
));
add(Entity::new(
"board.display.{n}.refresh_rate",
D::Board,
K::Measurement,
Some(U::Hertz),
P::Measured,
true,
"Refresh rate of the mode currently set.",
));
add(Entity::new(
"board.display.{n}.primary",
D::Board,
K::Identity,
None,
P::Measured,
false,
"Whether the platform treats this as the primary display.",
));
// ── Platform sensors ─────────────────────────────────────────────────
//
// The last cluster named in plan item F. These are the OS-level sensor
// devices — ambient light, accelerometer, orientation — not the board
// temperature sensors, which resolve under `thermal`.
add(Entity::new(
"board.sensor.<none>",
D::Board,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no platform sensor was enumerated, carrying why. A desktop reporting none is the common case and a true reading; this row distinguishes it from a query that could not be made.",
));
add(Entity::new(
"board.sensor.{n}.name",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Sensor name as the platform reports it. A sensor the platform did not name is skipped rather than called \"Unknown\".",
));
add(Entity::new(
"board.sensor.{n}.type",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
false,
"Sensor kind - ambient light, accelerometer, gyroscope, orientation.",
));
add(Entity::new(
"board.sensor.{n}.active",
D::Board,
K::Identity,
None,
P::Measured,
false,
"Whether the platform reports this sensor as ready. A present but inactive sensor is a different fact from an absent one.",
));
// ── Package energy (RAPL) ────────────────────────────────────────────
//
// Named in the plan's item F as a remaining cluster. Templated per
// package because a two-socket machine has two, and the diagnostic for
// "this platform has no RAPL" is the domain's `<none>` row, which
// already exists for every domain.
add(Entity::new(
"power.rapl.<none>",
D::Power,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when no RAPL energy domain was enumerated, carrying why. A sub-cluster diagnostic rather than the domain-wide `power.<none>`: a machine can have a readable battery and no RAPL interface, and claiming the whole power domain enumerated nothing would be false.",
));
add(Entity::new(
"power.rapl.{n}.name",
D::Power,
K::Identity,
Some(U::Text),
P::Measured,
false,
"RAPL domain name as the platform reports it - package-0, core, dram, uncore.",
));
add(Entity::new(
"power.rapl.{n}.energy",
D::Power,
K::Measurement,
Some(U::Count),
P::Measured,
false,
"Cumulative energy counter in microjoules. A counter, not a rate: it wraps at `max_energy_range`, and power in watts is the difference between two readings divided by the interval. Reported raw because a single sample cannot be converted to watts and pretending otherwise would invent a rate.",
));
add(Entity::new(
"power.rapl.{n}.max_energy_range",
D::Power,
K::Limit,
Some(U::Count),
P::Specification,
false,
"The value the energy counter wraps at, in microjoules. Needed to compute power across a wrap; a consumer without it will read a wrap as a negative delta.",
));
add(Entity::new(
"power.rapl.{n}.power_limit",
D::Power,
K::Limit,
Some(U::Watts),
P::Specification,
true,
"The configured power limit for this domain. Nullable: not every RAPL domain publishes a constraint.",
));
add(Entity::new(
"power.rapl.{n}.enabled",
D::Power,
K::Identity,
None,
P::Specification,
false,
"Whether the platform reports this domain as enabled. A disabled domain still has a counter and it does not advance.",
));
// ── Memory bandwidth ─────────────────────────────────────
//
// Every figure here except the configuration itself is `Derived`, and
// that matters more than usual: nothing in this cluster was measured.
// The peak is arithmetic over the channel count and the transfer rate,
// and the achievable and STREAM figures are that peak scaled by a
// constant. An agent choosing a batch size from these should know it is
// reading a calculation and not a benchmark - which is what the
// provenance field is for.
add(Entity::new(
"memory.bandwidth.<none>",
D::Memory,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present when the memory configuration needed to estimate bandwidth \
could not be read, carrying why.",
));
add(Entity::new(
"memory.bandwidth.generation",
D::Memory,
K::Identity,
Some(U::Identifier),
P::Specification,
true,
"Memory generation the estimate rests on - DDR5, LPDDR5X, HBM3. \
Nullable because a virtual machine's SMBIOS routinely names no \
generation at all, which is what both CI runners see; naming one \
anyway would put a spec-sheet figure behind a bandwidth estimate \
that has no memory type to rest on.",
));
add(Entity::new(
"memory.bandwidth.speed",
D::Memory,
K::Identity,
Some(U::Count),
P::Specification,
true,
"Transfer rate in megatransfers per second, as used in the estimate. Nullable because it is the generation's figure: with no generation identified the estimator substitutes 3200 MT/s, which is a default and not a reading.",
));
add(Entity::new(
"memory.bandwidth.channels",
D::Memory,
K::Identity,
Some(U::Count),
P::Specification,
// Nullable: where the memory configuration cannot be read at all --
// every Mac, and a machine without readable SMBIOS -- there is no
// channel count, and a null here is that fact rather than a reader
// bug.
true,
"Active channel count. The largest single term in the estimate: a \
dual-channel machine misread as single-channel halves every figure \
below it.",
));
add(Entity::new(
"memory.bandwidth.max_channels",
D::Memory,
K::Limit,
Some(U::Count),
P::Specification,
// Nullable for the same reason as `channels`.
true,
"Channels the controller supports. Above `channels` means the machine \
is running below the bandwidth its board allows, which is usually a \
populated-slot problem and worth being able to see.",
));
add(Entity::new(
"memory.bandwidth.peak",
D::Memory,
K::Limit,
Some(U::BytesPerSecond),
P::Derived,
true,
"Theoretical peak bandwidth, computed from the transfer rate, the bus \
width and the channel count. No workload reaches it. Nullable: withheld entirely when the generation was not identified, since the transfer rate and bus width it needs would both be built-in defaults.",
)
.derived(&[
"memory.bandwidth.generation",
"memory.bandwidth.speed",
"memory.bandwidth.channels",
]));
add(Entity::new(
"memory.bandwidth.achievable",
D::Memory,
K::Limit,
Some(U::BytesPerSecond),
P::Derived,
true,
"Peak scaled by a fixed efficiency factor. A rule of thumb rendered as \
a number; it carries no information the peak and the factor do not \
already contain. Nullable with peak, and for the same reason -- the efficiency factor also falls back to a default when the generation is unknown.",
)
.derived(&[
"memory.bandwidth.generation",
"memory.bandwidth.speed",
"memory.bandwidth.channels",
]));
add(Entity::new(
"memory.bandwidth.stream_triad",
D::Memory,
K::Limit,
Some(U::BytesPerSecond),
P::Derived,
true,
"What the STREAM Triad benchmark would be expected to report. Named \
after the benchmark but not produced by running it - ironmon runs no \
benchmarks, and a consumer comparing this against a real STREAM \
result is comparing an estimate to a measurement. Nullable with peak and achievable, which it is scaled from.",
)
.derived(&[
"memory.bandwidth.generation",
"memory.bandwidth.speed",
"memory.bandwidth.channels",
]));
// ── System and board ─────────────────────────────────────────────────
//
// The four below were readable by `os_info` long before they were named
// here. A reader holding data the schema does not expose is invisible to
// every agent, which is the same silence this module exists to prevent —
// it just happens one level up.
add(Entity::new(
"system.hostname",
D::System,
K::Identity,
Some(U::Text),
P::Measured,
true,
"The machine's hostname. Nullable: a container or a freshly imaged host may genuinely have none set.",
));
add(Entity::new(
"system.os.version",
D::System,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Operating system version string, as distinct from the build number and from the product name.",
));
add(Entity::new(
"system.kernel.version",
D::System,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Kernel version. On Windows this is the NT build rather than a separate kernel line, which is why it can equal the OS build.",
));
add(Entity::new(
"system.architecture",
D::System,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"CPU architecture the OS reports — x86_64, aarch64. The architecture of the running kernel, which on some hosts differs from the hardware's.",
));
add(Entity::new(
"system.os.name",
D::System,
K::Identity,
Some(U::Text),
P::Measured,
false,
"Operating system product name, corrected where the vendor's own \
registry is stale.",
));
add(Entity::new(
"system.os.build",
D::System,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"OS build identifier.",
));
add(Entity::new(
"system.uptime",
D::System,
K::Measurement,
Some(U::Seconds),
P::Measured,
// Nullable: the resolver reports it absent when the uptime
// reader errors.
true,
"Seconds since boot.",
));
add(Entity::new(
"system.boot.duration",
D::System,
K::Measurement,
Some(U::Seconds),
P::Measured,
true,
"Measured boot duration. Null when it could not be read — never a \
representative constant.",
));
add(Entity::new(
"system.boot.secure_boot",
D::System,
K::Identity,
None,
P::Measured,
true,
"Whether Secure Boot is enforcing, read from the firmware flag itself \
rather than inferred from the presence of the key holding it.",
));
add(Entity::new(
"board.model",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Baseboard product name from SMBIOS.",
));
add(Entity::new(
"board.firmware.vendor",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"System firmware vendor, from SMBIOS.",
));
add(Entity::new(
"board.firmware.product",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"System product name, from SMBIOS.",
));
add(Entity::new(
"board.firmware.boot_mode",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Whether the machine booted UEFI or legacy BIOS. Determines whether \
Secure Boot is even applicable.",
));
add(Entity::new(
"board.firmware.{n}.component",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"Name of one component in the firmware inventory — BIOS, ME, a device \
option ROM.",
));
add(Entity::new(
"board.firmware.{n}.version",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Installed version of that component.",
));
add(Entity::new(
"board.tpm.present",
D::Board,
K::Identity,
None,
P::Measured,
// Nullable since 6.0.0. `TpmMonitor::refresh` can report a
// failure now, and the resolver already said what to do with
// one: "not knowing whether a TPM exists is different from
// knowing there is none".
true,
"Whether a TPM was enumerated at all. False is a reading: the absence \
of a TPM is a fact about the machine, distinct from being unable to \
look.",
));
add(Entity::new(
"board.tpm.version",
D::Board,
K::Identity,
Some(U::Identifier),
P::Measured,
true,
"TPM specification version. Null when no TPM is present.",
));
add(Entity::new(
"board.tpm.manufacturer",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"TPM manufacturer string.",
));
add(Entity::new(
"board.tpm.status",
D::Board,
K::Measurement,
Some(U::Identifier),
P::Measured,
true,
"Whether the TPM is enabled, activated and owned. A present but \
disabled TPM cannot attest anything, so presence alone is not the \
question an agent should ask.",
));
add(Entity::new(
"board.tpm.measured_boot",
D::Board,
K::Measurement,
None,
P::Measured,
true,
"Whether platform integrity measurements are active.",
));
add(Entity::new(
"board.manufacturer",
D::Board,
K::Identity,
Some(U::Text),
P::Measured,
true,
"Baseboard manufacturer from SMBIOS.",
));
// ── Writable settings ────────────────────────────────────────────────
//
// Generated from the apply-handler registry rather than listed here, for the
// same reason the command catalogue is walked out of clap: a hand-maintained
// list would claim a write the binary cannot perform the first time a
// handler was removed and nobody remembered this function. An agent reading
// `writable_via` is being told it can change something, which is a promise
// that has to be backed by a registered handler.
//
// Until this existed, `EntityKind::Setting` and `Entity::writable_via` were
// declared and populated by nothing: the ontology described a machine an
// agent could only read, while `ironmon profile set` could write.
for handler in crate::profile::apply::builtin_handlers() {
let setting_id = handler.setting_id();
let domain = setting_domain(handler.subsystem());
let mut entity = Entity::new(
&format!("{}.setting.{}", domain.as_str(), setting_id),
domain,
K::Setting,
Some(U::Identifier),
P::Measured,
true,
"A driver or firmware setting with a registered write handler. \
Writing requires explicit confirmation and is recorded in the \
apply audit log.",
);
entity.writable_via = Some(setting_id.to_string());
add(entity);
}
// ── Diagnostics ──────────────────────────────────────────────────────
//
// Declared, not synthesised at read time, because everything the resolver
// emits has to be findable in the schema an agent fetched beforehand. These
// were the one class of row that violated that: emitting an undeclared
// `disk.<none>` told an agent something true in a vocabulary it had no way
// to look up.
for domain in Domain::ALL {
add(Entity::new(
&format!("{}.<none>", domain.as_str()),
*domain,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present only when this domain enumerated nothing. Carries the \
reason, so an absent device stays distinguishable from a reader \
that is not implemented here.",
));
}
add(Entity::new(
"gpu.{n}.<unreadable>",
D::Gpu,
K::Diagnostic,
None,
P::Unavailable,
true,
"Present in place of an adapter's readings when that adapter was \
enumerated but its query failed. Carries the error. The other \
adapters are reported as usual, and the index stays the adapter's own.",
));
add(Entity::new(
"process.<truncated>",
D::Process,
K::Diagnostic,
Some(U::Count),
P::Unavailable,
true,
"Present when the process list was capped. Absence from a truncated \
list is not absence from the machine.",
));
Self {
version: ONTOLOGY_VERSION.to_string(),
entities,
}
}
pub fn get(&self, id: &str) -> Option<&Entity> {
self.entities.get(id)
}
/// Entities in one domain, in id order.
pub fn in_domain(&self, domain: Domain) -> Vec<&Entity> {
self.entities
.values()
.filter(|e| e.domain == domain)
.collect()
}
/// Substring search over ids and descriptions, for agents that do not yet know
/// the id space.
pub fn search(&self, needle: &str) -> Vec<&Entity> {
let needle = needle.to_ascii_lowercase();
self.entities
.values()
.filter(|e| {
e.id.to_ascii_lowercase().contains(&needle)
|| e.description.to_ascii_lowercase().contains(&needle)
})
.collect()
}
/// Ids whose value is a template — `gpu.{n}.name` rather than a concrete
/// `gpu.0.name`. A consumer expands these against the live instance count.
pub fn is_template(id: &str) -> bool {
id.contains('{')
}
/// The entity a concrete id belongs to, resolving templates.
///
/// `gpu.0.name` finds `gpu.{n}.name`; an exact id finds itself. This is the
/// inverse of expansion, and the lookup an agent needs when it holds a reading
/// and wants the schema behind it — the unit it is in, whether it may be null,
/// and the range it must fall inside.
///
/// Segment count must match, so `disk.0.smart.passed` cannot match
/// `disk.{n}.model`. A `{placeholder}` segment matches any single segment.
pub fn template_for(&self, concrete: &str) -> Option<&Entity> {
if let Some(e) = self.get(concrete) {
return Some(e);
}
let parts: Vec<&str> = concrete.split('.').collect();
self.entities.values().find(|e| {
let tparts: Vec<&str> = e.id.split('.').collect();
tparts.len() == parts.len()
&& tparts
.iter()
.zip(&parts)
.all(|(t, c)| t.starts_with('{') || t == c)
})
}
/// Expand a template id for a concrete instance.
///
/// `gpu.{n}.name` with `"0"` becomes `gpu.0.name`. Returns the id unchanged when
/// it holds no placeholder, so callers need not special-case singletons.
pub fn instantiate(id: &str, instance: &str) -> String {
if let Some(open) = id.find('{') {
if let Some(close) = id[open..].find('}') {
let mut out = String::with_capacity(id.len() + instance.len());
out.push_str(&id[..open]);
out.push_str(instance);
out.push_str(&id[open + close + 1..]);
return out;
}
}
id.to_string()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn every_id_is_unique_and_well_formed() {
let ont = Ontology::build();
assert!(!ont.entities.is_empty(), "ontology is empty");
for (key, e) in &ont.entities {
assert_eq!(key, &e.id, "map key and entity id disagree");
assert!(
e.id.starts_with(e.domain.as_str()),
"{} is not namespaced under its domain {}",
e.id,
e.domain.as_str()
);
assert!(
!e.description.is_empty(),
"{} has no description; the ontology exists to be read by something \
that cannot see the hardware",
e.id
);
assert!(
!e.id.ends_with('.') && !e.id.contains(".."),
"malformed id: {}",
e.id
);
}
}
/// `writable_via` tells an agent it may change something. That is a promise, and
/// it must be backed by a handler that actually exists — a schema claiming a
/// write the binary cannot perform is worse than one claiming nothing, because
/// the agent will try.
#[test]
fn every_writable_entity_has_a_registered_handler() {
let ont = Ontology::build();
let registered: Vec<String> = crate::profile::apply::builtin_handlers()
.iter()
.map(|h| h.setting_id().to_string())
.collect();
for e in ont.entities.values() {
let Some(setting_id) = &e.writable_via else {
continue;
};
assert_eq!(
e.kind,
EntityKind::Setting,
"{} declares writable_via but is not a Setting",
e.id
);
assert!(
registered.contains(setting_id),
"{} claims it can be written via {setting_id:?}, but no such apply \
handler is registered on this build; an agent told this would \
attempt a write that cannot succeed. Registered: {registered:?}",
e.id
);
}
}
/// The converse: a handler the binary exposes but the schema hides is a
/// capability an agent cannot discover. Reading `ironmon profile writable` should
/// not reveal anything `ironmon describe` omits.
#[test]
fn every_registered_handler_is_discoverable_in_the_schema() {
let ont = Ontology::build();
let declared: Vec<&String> = ont
.entities
.values()
.filter_map(|e| e.writable_via.as_ref())
.collect();
for handler in crate::profile::apply::builtin_handlers() {
let id = handler.setting_id().to_string();
assert!(
declared.contains(&&id),
"the apply registry exposes {id:?} but no ontology entity declares \
it, so an agent reading the schema cannot discover it"
);
}
}
/// Settings are only meaningful if the kind is used at all — an assertion over
/// an empty set would pass while the write surface was entirely undeclared,
/// which is precisely the state this replaced.
#[test]
fn the_schema_declares_at_least_one_writable_setting() {
// Platform-dependent: a build with no handlers for this OS legitimately has
// none, so this only asserts the two views agree about how many there are.
let ont = Ontology::build();
let declared = ont
.entities
.values()
.filter(|e| e.kind == EntityKind::Setting)
.count();
let registered = crate::profile::apply::builtin_handlers().len();
assert_eq!(
declared, registered,
"the schema declares {declared} writable settings but the apply registry \
has {registered}"
);
}
/// A derived value is only as trustworthy as its inputs, so it has to name them.
#[test]
fn derived_entities_declare_their_inputs() {
let ont = Ontology::build();
for e in ont.entities.values() {
if e.provenance == Provenance::Derived {
assert!(
!e.derived_from.is_empty(),
"{} is derived but names no inputs",
e.id
);
for input in &e.derived_from {
assert!(
ont.get(input).is_some(),
"{} derives from {input}, which is not in the ontology",
e.id
);
}
} else {
assert!(
e.derived_from.is_empty(),
"{} names inputs but is not marked derived",
e.id
);
}
}
}
/// Only `Measured` counts as an observation. This is the guard that stops an
/// agent treating a spec-sheet constant as a live reading.
#[test]
fn only_measured_values_are_observations() {
assert!(Provenance::Measured.is_observation());
assert!(!Provenance::Specification.is_observation());
assert!(!Provenance::Derived.is_observation());
assert!(!Provenance::Unavailable.is_observation());
}
#[test]
fn range_validation_rejects_impossible_readings() {
let ont = Ontology::build();
let util = ont.get("cpu.total.utilization").unwrap();
assert!(util.validate_range(50.0).is_none());
assert!(util.validate_range(-1.0).is_some(), "negative percent");
assert!(util.validate_range(101.0).is_some(), "over 100 percent");
let temp = ont.get("gpu.{n}.thermal.temperature").unwrap();
assert!(temp.validate_range(45.0).is_none());
// Celsius may be negative; absolute zero may not be undercut.
assert!(temp.validate_range(-10.0).is_none());
assert!(temp.validate_range(-300.0).is_some(), "below absolute zero");
assert!(temp.validate_range(500.0).is_some(), "implausibly hot");
}
#[test]
fn templates_expand_to_concrete_ids() {
assert!(Ontology::is_template("gpu.{n}.name"));
assert!(!Ontology::is_template("memory.total"));
assert_eq!(Ontology::instantiate("gpu.{n}.name", "0"), "gpu.0.name");
assert_eq!(
Ontology::instantiate("network.{iface}.rx_rate", "eth0"),
"network.eth0.rx_rate"
);
// Non-templates pass through untouched.
assert_eq!(Ontology::instantiate("memory.total", "0"), "memory.total");
}
#[test]
fn lookup_and_search_find_entities() {
let ont = Ontology::build();
assert!(ont.get("memory.total").is_some());
assert!(ont.get("no.such.entity").is_none());
assert!(!ont.in_domain(Domain::Gpu).is_empty());
assert!(
!ont.search("temperature").is_empty(),
"search should find thermal entities"
);
assert_eq!(Domain::parse("gpu"), Some(Domain::Gpu));
assert_eq!(Domain::parse("GPU"), Some(Domain::Gpu));
assert_eq!(Domain::parse("nonsense"), None);
}
/// The ontology must not depend on the machine it is built on: an agent fetches
/// it as a schema, so two builds have to agree.
#[test]
fn build_is_deterministic_and_hardware_independent() {
let a = serde_json::to_string(&Ontology::build()).unwrap();
let b = serde_json::to_string(&Ontology::build()).unwrap();
assert_eq!(a, b);
}
}
/// Human-facing labels, derived from the ontology rather than retyped per surface.
///
/// The CLI printed `Kernel:`, the GUI printed `Kernel Version`, and the JSON emitted
/// `kernel_version` — three names for one reading, which is exactly what stops an
/// agent correlating what a user reports seeing with what it can query. These
/// helpers give the TUI and GUI the same source the CLI and `ironmon describe` use, so
/// a label shown on screen can be turned back into an id.
pub mod labels {
use super::{Domain, Ontology};
/// Title-cased label for an entity id, e.g. `gpu.0.thermal.temperature` ->
/// "Temperature". Falls back to the last path segment for ids the ontology does
/// not declare, so a surface never renders a raw dotted id at a user.
pub fn short_label(id: &str) -> String {
let leaf = id.rsplit('.').next().unwrap_or(id);
title_case(leaf)
}
/// Fully qualified label including the domain and instance, e.g.
/// "GPU 0 — Temperature". Used where a surface shows readings from several
/// devices in one list.
pub fn qualified_label(id: &str) -> String {
let parts: Vec<&str> = id.split('.').collect();
let short = short_label(id);
match parts.as_slice() {
[domain, instance, ..] if instance.chars().all(|c| c.is_ascii_digit()) => {
format!("{} {} — {}", domain_label(domain), instance, short)
}
[domain, ..] => format!("{} — {}", domain_label(domain), short),
[] => short,
}
}
/// Display name for a domain, preserving the acronyms users expect to see.
pub fn domain_label(domain: &str) -> String {
match domain {
"cpu" => "CPU".to_string(),
"gpu" => "GPU".to_string(),
// Added with the `usb` domain in 3.4.0. Without it the GUI's existing
// "USB Devices" heading and the ontology's `Usb` disagreed, which is
// precisely what `hardcoded_headings_do_not_contradict_the_ontology`
// exists to catch — and did, on the commit that introduced the domain.
"usb" => "USB".to_string(),
_ => title_case(domain),
}
}
/// The id a label came from, if the ontology declares exactly one match.
///
/// The inverse direction, and the reason the labels live here: an agent handed
/// "Temperature" by a user looking at the GUI can ask which ids that could mean
/// instead of guessing.
pub fn ids_for_label(label: &str) -> Vec<String> {
let ontology = Ontology::build();
let needle = label.trim().to_ascii_lowercase();
ontology
.entities
.keys()
.filter(|id| short_label(id).to_ascii_lowercase() == needle)
.cloned()
.collect()
}
/// Whether a domain name is one the ontology knows, so a surface can assert its
/// section headings correspond to real domains.
pub fn is_known_domain(domain: &str) -> bool {
Domain::parse(domain).is_some()
}
fn title_case(s: &str) -> String {
s.split('_')
.map(|word| {
let mut chars = word.chars();
match chars.next() {
Some(first) => {
first.to_uppercase().collect::<String>() + &chars.as_str().to_lowercase()
}
None => String::new(),
}
})
.collect::<Vec<_>>()
.join(" ")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn labels_are_derived_from_ids() {
assert_eq!(short_label("gpu.0.thermal.temperature"), "Temperature");
assert_eq!(short_label("memory.total"), "Total");
assert_eq!(short_label("system.os.name"), "Name");
// Underscores become spaces, not run-together words.
assert_eq!(
short_label("gpu.0.thermal.critical_temperature"),
"Critical Temperature"
);
}
#[test]
fn qualified_labels_name_the_device() {
assert_eq!(
qualified_label("gpu.0.thermal.temperature"),
"GPU 0 — Temperature"
);
assert_eq!(qualified_label("memory.total"), "Memory — Total");
// Acronyms survive title-casing.
assert_eq!(domain_label("cpu"), "CPU");
assert_eq!(domain_label("memory"), "Memory");
}
/// The inverse direction has to actually work, or the label layer is
/// decoration rather than a mapping.
#[test]
fn labels_map_back_to_ids() {
let ids = ids_for_label("Total");
assert!(
ids.contains(&"memory.total".to_string()),
"expected memory.total among {ids:?}"
);
assert!(ids_for_label("no such label").is_empty());
}
#[test]
fn every_ontology_domain_is_a_known_domain() {
for d in Domain::ALL {
assert!(is_known_domain(d.as_str()));
}
assert!(!is_known_domain("nonsense"));
}
/// No entity may produce an empty label — a surface would render a blank.
#[test]
fn no_entity_yields_an_empty_label() {
for id in Ontology::build().entities.keys() {
assert!(
!short_label(id).trim().is_empty(),
"{id} produced an empty label"
);
assert!(
!qualified_label(id).trim().is_empty(),
"{id} produced an empty qualified label"
);
}
}
}
}