Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53dad97c6c | ||
|
|
e49c471bad | ||
|
|
c8743e2578 | ||
|
|
544de0ff88 | ||
|
|
3224558ac4 |
@@ -20,7 +20,7 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
name: Build & Test (Intel x86_64)
|
name: Build & Test (Intel x86_64)
|
||||||
runs-on: [macos, intel]
|
runs-on: macos-14
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
|
|||||||
@@ -12,10 +12,12 @@
|
|||||||
1879A3DCF6E305D7F2CD472E /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2345555FF9780B02A90CC7A9 /* CoreFoundation.framework */; };
|
1879A3DCF6E305D7F2CD472E /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2345555FF9780B02A90CC7A9 /* CoreFoundation.framework */; };
|
||||||
1B15F48F6B19E9EA4556ECD5 /* MMStorageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78325870C7CD8312AECA2236 /* MMStorageTests.swift */; };
|
1B15F48F6B19E9EA4556ECD5 /* MMStorageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78325870C7CD8312AECA2236 /* MMStorageTests.swift */; };
|
||||||
1B3F1C8ABF0ADFAA290FF6F6 /* MMSMCParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 375AA781A2AA0A20B119C7B7 /* MMSMCParser.m */; };
|
1B3F1C8ABF0ADFAA290FF6F6 /* MMSMCParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 375AA781A2AA0A20B119C7B7 /* MMSMCParser.m */; };
|
||||||
|
22CA7351A745F7837E487051 /* MMPeripheralsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1486E1512594482380CB492 /* MMPeripheralsTests.swift */; };
|
||||||
2C0F7AB93691ED8AA86FBCF0 /* MMProcessDetailInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E641F8A664D456518EDBA4 /* MMProcessDetailInspector.m */; };
|
2C0F7AB93691ED8AA86FBCF0 /* MMProcessDetailInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E641F8A664D456518EDBA4 /* MMProcessDetailInspector.m */; };
|
||||||
3BA6709B727B1AAC6C4310B5 /* MMProcessDetailsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7187632FF63B3B0D07FE9194 /* MMProcessDetailsTests.swift */; };
|
3BA6709B727B1AAC6C4310B5 /* MMProcessDetailsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7187632FF63B3B0D07FE9194 /* MMProcessDetailsTests.swift */; };
|
||||||
3C0AC14F803C813287D8A663 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007F48A5A599AB4E8D216D16 /* IOKit.framework */; };
|
3C0AC14F803C813287D8A663 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007F48A5A599AB4E8D216D16 /* IOKit.framework */; };
|
||||||
4419FE7554489B23976E2970 /* MMCPULoadProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = D68FC8100D08DB6202F46339 /* MMCPULoadProvider.m */; };
|
4419FE7554489B23976E2970 /* MMCPULoadProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = D68FC8100D08DB6202F46339 /* MMCPULoadProvider.m */; };
|
||||||
|
4752C49841375B88194F7635 /* MMPeripheralsProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E6A10A13A49E22E51862895 /* MMPeripheralsProvider.m */; };
|
||||||
4C1A92F4DEF4C824976115C2 /* MMNetworkSocketsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 374B1BF631CC4738CB52CA3B /* MMNetworkSocketsTests.swift */; };
|
4C1A92F4DEF4C824976115C2 /* MMNetworkSocketsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 374B1BF631CC4738CB52CA3B /* MMNetworkSocketsTests.swift */; };
|
||||||
57BA02AE1CE24DBD02BD03A4 /* MMComponentThermalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B288C7402E2C00E75F8CD016 /* MMComponentThermalTests.swift */; };
|
57BA02AE1CE24DBD02BD03A4 /* MMComponentThermalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B288C7402E2C00E75F8CD016 /* MMComponentThermalTests.swift */; };
|
||||||
5D31906EA986E2BA92E86FA8 /* MMNetworkBandwidthTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27C612287333D757C92A076A /* MMNetworkBandwidthTests.swift */; };
|
5D31906EA986E2BA92E86FA8 /* MMNetworkBandwidthTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27C612287333D757C92A076A /* MMNetworkBandwidthTests.swift */; };
|
||||||
@@ -34,6 +36,7 @@
|
|||||||
951DBA5D3BBAB753322A5DF9 /* MMLoadAverageProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = B5F2256DF514DD737306302B /* MMLoadAverageProvider.m */; };
|
951DBA5D3BBAB753322A5DF9 /* MMLoadAverageProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = B5F2256DF514DD737306302B /* MMLoadAverageProvider.m */; };
|
||||||
9B5C651AD2AF7DE2738F0C44 /* MMPowerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D48698681374BD25B980C000 /* MMPowerTests.swift */; };
|
9B5C651AD2AF7DE2738F0C44 /* MMPowerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D48698681374BD25B980C000 /* MMPowerTests.swift */; };
|
||||||
9BCE74C5454F81EF80492E75 /* MacMonitorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC3EDFCD5C50CB352FCED87 /* MacMonitorTests.swift */; };
|
9BCE74C5454F81EF80492E75 /* MacMonitorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC3EDFCD5C50CB352FCED87 /* MacMonitorTests.swift */; };
|
||||||
|
9D12825C7904FB0DAE664CA0 /* MMAudioTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10D16E1ABE6D28B676EA83FF /* MMAudioTests.swift */; };
|
||||||
A521961E035DD50ED8B0C1A9 /* MMKernelTelemetryProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = F444F4543F0A7421C8F8E636 /* MMKernelTelemetryProvider.m */; };
|
A521961E035DD50ED8B0C1A9 /* MMKernelTelemetryProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = F444F4543F0A7421C8F8E636 /* MMKernelTelemetryProvider.m */; };
|
||||||
A599E974E56F0B8D94A7E480 /* MMNetworkSocketsProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = D78F76C1996D7FCA241CE532 /* MMNetworkSocketsProvider.m */; };
|
A599E974E56F0B8D94A7E480 /* MMNetworkSocketsProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = D78F76C1996D7FCA241CE532 /* MMNetworkSocketsProvider.m */; };
|
||||||
A7609CE56D49EC3419987468 /* SystemTelemetryStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B4E94FB2886C60D5548A2A /* SystemTelemetryStore.swift */; };
|
A7609CE56D49EC3419987468 /* SystemTelemetryStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B4E94FB2886C60D5548A2A /* SystemTelemetryStore.swift */; };
|
||||||
@@ -43,6 +46,7 @@
|
|||||||
B9C2D6574E808B517BA34C83 /* MMMemoryTelemetryProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 991AEEAF262F3C6BE930BC77 /* MMMemoryTelemetryProvider.m */; };
|
B9C2D6574E808B517BA34C83 /* MMMemoryTelemetryProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 991AEEAF262F3C6BE930BC77 /* MMMemoryTelemetryProvider.m */; };
|
||||||
BC487DB86227F09CB0603894 /* MMBatteryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EB61D811D989279BCBE478 /* MMBatteryTests.swift */; };
|
BC487DB86227F09CB0603894 /* MMBatteryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EB61D811D989279BCBE478 /* MMBatteryTests.swift */; };
|
||||||
CD91FC663B19DA1FEA3D49D7 /* MMAppleSMCClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 5555436CD3CB8A73F5D6504F /* MMAppleSMCClient.m */; };
|
CD91FC663B19DA1FEA3D49D7 /* MMAppleSMCClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 5555436CD3CB8A73F5D6504F /* MMAppleSMCClient.m */; };
|
||||||
|
D7784A61FE4635275CFB3D6C /* MMAudioTelemetryProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 3189D2403E6E984D4924AE4D /* MMAudioTelemetryProvider.m */; };
|
||||||
E3CCE93A7D4D1EB0187D3E52 /* MMNetworkBandwidthProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = C539AEA27C794C6F428EA875 /* MMNetworkBandwidthProvider.m */; };
|
E3CCE93A7D4D1EB0187D3E52 /* MMNetworkBandwidthProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = C539AEA27C794C6F428EA875 /* MMNetworkBandwidthProvider.m */; };
|
||||||
E6F2F695B8D3E7045967C082 /* MMFanTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 336CEE35A745F3C7E9F70F43 /* MMFanTests.swift */; };
|
E6F2F695B8D3E7045967C082 /* MMFanTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 336CEE35A745F3C7E9F70F43 /* MMFanTests.swift */; };
|
||||||
EAFAF5A10502D4ACC64F4720 /* MMTelemetryCoordinator.m in Sources */ = {isa = PBXBuildFile; fileRef = F9F9AD1268F906761032AF4D /* MMTelemetryCoordinator.m */; };
|
EAFAF5A10502D4ACC64F4720 /* MMTelemetryCoordinator.m in Sources */ = {isa = PBXBuildFile; fileRef = F9F9AD1268F906761032AF4D /* MMTelemetryCoordinator.m */; };
|
||||||
@@ -69,13 +73,16 @@
|
|||||||
099DCF7EF03A58ADA40A94A1 /* MMMemoryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMMemoryTests.swift; sourceTree = "<group>"; };
|
099DCF7EF03A58ADA40A94A1 /* MMMemoryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMMemoryTests.swift; sourceTree = "<group>"; };
|
||||||
0C94CCFBE8C9E1370368A28C /* MMNetworkSocketsProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMNetworkSocketsProvider.h; sourceTree = "<group>"; };
|
0C94CCFBE8C9E1370368A28C /* MMNetworkSocketsProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMNetworkSocketsProvider.h; sourceTree = "<group>"; };
|
||||||
0F2BD3777A674DC4EB442890 /* MMCPUThermalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMCPUThermalTests.swift; sourceTree = "<group>"; };
|
0F2BD3777A674DC4EB442890 /* MMCPUThermalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMCPUThermalTests.swift; sourceTree = "<group>"; };
|
||||||
|
10D16E1ABE6D28B676EA83FF /* MMAudioTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMAudioTests.swift; sourceTree = "<group>"; };
|
||||||
1AD9EEE571CD904BBCD1C96B /* MMSMCParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMSMCParser.h; sourceTree = "<group>"; };
|
1AD9EEE571CD904BBCD1C96B /* MMSMCParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMSMCParser.h; sourceTree = "<group>"; };
|
||||||
1B07A683AD0EFBA8E1FB6C9D /* MMProcessDetailInspector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMProcessDetailInspector.h; sourceTree = "<group>"; };
|
1B07A683AD0EFBA8E1FB6C9D /* MMProcessDetailInspector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMProcessDetailInspector.h; sourceTree = "<group>"; };
|
||||||
2345555FF9780B02A90CC7A9 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
2345555FF9780B02A90CC7A9 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
||||||
27C612287333D757C92A076A /* MMNetworkBandwidthTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMNetworkBandwidthTests.swift; sourceTree = "<group>"; };
|
27C612287333D757C92A076A /* MMNetworkBandwidthTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMNetworkBandwidthTests.swift; sourceTree = "<group>"; };
|
||||||
2C55E977DBFBE7FF04621608 /* MMLoadAverageProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMLoadAverageProvider.h; sourceTree = "<group>"; };
|
2C55E977DBFBE7FF04621608 /* MMLoadAverageProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMLoadAverageProvider.h; sourceTree = "<group>"; };
|
||||||
2DC6E55C9D3F646A1C62133D /* MMBatteryTelemetryProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMBatteryTelemetryProvider.h; sourceTree = "<group>"; };
|
2DC6E55C9D3F646A1C62133D /* MMBatteryTelemetryProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMBatteryTelemetryProvider.h; sourceTree = "<group>"; };
|
||||||
|
2E6A10A13A49E22E51862895 /* MMPeripheralsProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMPeripheralsProvider.m; sourceTree = "<group>"; };
|
||||||
2EC3EDFCD5C50CB352FCED87 /* MacMonitorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacMonitorTests.swift; sourceTree = "<group>"; };
|
2EC3EDFCD5C50CB352FCED87 /* MacMonitorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacMonitorTests.swift; sourceTree = "<group>"; };
|
||||||
|
3189D2403E6E984D4924AE4D /* MMAudioTelemetryProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMAudioTelemetryProvider.m; sourceTree = "<group>"; };
|
||||||
32340166F6100A08105308D3 /* MMTelemetryCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTelemetryCoordinator.h; sourceTree = "<group>"; };
|
32340166F6100A08105308D3 /* MMTelemetryCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTelemetryCoordinator.h; sourceTree = "<group>"; };
|
||||||
336CEE35A745F3C7E9F70F43 /* MMFanTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMFanTests.swift; sourceTree = "<group>"; };
|
336CEE35A745F3C7E9F70F43 /* MMFanTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMFanTests.swift; sourceTree = "<group>"; };
|
||||||
374B1BF631CC4738CB52CA3B /* MMNetworkSocketsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMNetworkSocketsTests.swift; sourceTree = "<group>"; };
|
374B1BF631CC4738CB52CA3B /* MMNetworkSocketsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMNetworkSocketsTests.swift; sourceTree = "<group>"; };
|
||||||
@@ -92,6 +99,7 @@
|
|||||||
5635101F862DE680856BDE6E /* MMTelemetryDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTelemetryDomain.h; sourceTree = "<group>"; };
|
5635101F862DE680856BDE6E /* MMTelemetryDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTelemetryDomain.h; sourceTree = "<group>"; };
|
||||||
56E285A0A1746AE659981F22 /* MacMonitorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacMonitorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
56E285A0A1746AE659981F22 /* MacMonitorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacMonitorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
57845310A3D4EC67E48A3B11 /* MMCPULoadProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMCPULoadProvider.h; sourceTree = "<group>"; };
|
57845310A3D4EC67E48A3B11 /* MMCPULoadProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMCPULoadProvider.h; sourceTree = "<group>"; };
|
||||||
|
5C45D1EB09E045A53A154136 /* MMAudioTelemetryProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMAudioTelemetryProvider.h; sourceTree = "<group>"; };
|
||||||
62C377EFD025D6A6B5563E77 /* MMCPUThermalProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMCPUThermalProvider.m; sourceTree = "<group>"; };
|
62C377EFD025D6A6B5563E77 /* MMCPUThermalProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMCPUThermalProvider.m; sourceTree = "<group>"; };
|
||||||
6D0E5CAF25DFA9A1D2A698A0 /* MMTelemetryProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTelemetryProvider.h; sourceTree = "<group>"; };
|
6D0E5CAF25DFA9A1D2A698A0 /* MMTelemetryProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTelemetryProvider.h; sourceTree = "<group>"; };
|
||||||
6DCBCEA450103E2404761B78 /* MMStorageTelemetryProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMStorageTelemetryProvider.m; sourceTree = "<group>"; };
|
6DCBCEA450103E2404761B78 /* MMStorageTelemetryProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMStorageTelemetryProvider.m; sourceTree = "<group>"; };
|
||||||
@@ -115,6 +123,8 @@
|
|||||||
C65F5835516BC2A65BCE25D2 /* MMComponentThermalProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMComponentThermalProvider.m; sourceTree = "<group>"; };
|
C65F5835516BC2A65BCE25D2 /* MMComponentThermalProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMComponentThermalProvider.m; sourceTree = "<group>"; };
|
||||||
C9ED8F75E082D4F8AC2FF2F5 /* MMFanTelemetryProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMFanTelemetryProvider.m; sourceTree = "<group>"; };
|
C9ED8F75E082D4F8AC2FF2F5 /* MMFanTelemetryProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMFanTelemetryProvider.m; sourceTree = "<group>"; };
|
||||||
CBA91906CA8B7936CC82A36B /* MMPowerTelemetryProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMPowerTelemetryProvider.h; sourceTree = "<group>"; };
|
CBA91906CA8B7936CC82A36B /* MMPowerTelemetryProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMPowerTelemetryProvider.h; sourceTree = "<group>"; };
|
||||||
|
CDE2777944B8F12EC7D2EAB5 /* MMPeripheralsProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMPeripheralsProvider.h; sourceTree = "<group>"; };
|
||||||
|
D1486E1512594482380CB492 /* MMPeripheralsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMPeripheralsTests.swift; sourceTree = "<group>"; };
|
||||||
D48698681374BD25B980C000 /* MMPowerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMPowerTests.swift; sourceTree = "<group>"; };
|
D48698681374BD25B980C000 /* MMPowerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMPowerTests.swift; sourceTree = "<group>"; };
|
||||||
D61AB99733A4AA52459BA7C4 /* MMGPUTelemetryProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMGPUTelemetryProvider.m; sourceTree = "<group>"; };
|
D61AB99733A4AA52459BA7C4 /* MMGPUTelemetryProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMGPUTelemetryProvider.m; sourceTree = "<group>"; };
|
||||||
D68FC8100D08DB6202F46339 /* MMCPULoadProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMCPULoadProvider.m; sourceTree = "<group>"; };
|
D68FC8100D08DB6202F46339 /* MMCPULoadProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMCPULoadProvider.m; sourceTree = "<group>"; };
|
||||||
@@ -193,6 +203,15 @@
|
|||||||
path = Core;
|
path = Core;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
65251E6B5694734BAAF1C1F1 /* Peripherals */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
CDE2777944B8F12EC7D2EAB5 /* MMPeripheralsProvider.h */,
|
||||||
|
2E6A10A13A49E22E51862895 /* MMPeripheralsProvider.m */,
|
||||||
|
);
|
||||||
|
path = Peripherals;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
78383CED205BCA772701AE48 /* CPU */ = {
|
78383CED205BCA772701AE48 /* CPU */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -227,12 +246,14 @@
|
|||||||
8BF79E3BCB76E7A1669DC930 /* Telemetry */ = {
|
8BF79E3BCB76E7A1669DC930 /* Telemetry */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
92E1EF545807CF318620FEAA /* Audio */,
|
||||||
78383CED205BCA772701AE48 /* CPU */,
|
78383CED205BCA772701AE48 /* CPU */,
|
||||||
AD2995435E44FA3E1790A4F3 /* Fan */,
|
AD2995435E44FA3E1790A4F3 /* Fan */,
|
||||||
F99AF003017BA9F19F7AEB1E /* GPU */,
|
F99AF003017BA9F19F7AEB1E /* GPU */,
|
||||||
CA2F30473D63EC64CBD65437 /* Kernel */,
|
CA2F30473D63EC64CBD65437 /* Kernel */,
|
||||||
EE2F5EFC9DC33CEDA79A131F /* Memory */,
|
EE2F5EFC9DC33CEDA79A131F /* Memory */,
|
||||||
901D54FEAB6E9D6E787E599D /* Network */,
|
901D54FEAB6E9D6E787E599D /* Network */,
|
||||||
|
65251E6B5694734BAAF1C1F1 /* Peripherals */,
|
||||||
8B31CE7F9319FEC373E6CDC6 /* Power */,
|
8B31CE7F9319FEC373E6CDC6 /* Power */,
|
||||||
8719744C366432DD7C2B9644 /* Process */,
|
8719744C366432DD7C2B9644 /* Process */,
|
||||||
B6EB3F6545276C40212C2992 /* Storage */,
|
B6EB3F6545276C40212C2992 /* Storage */,
|
||||||
@@ -253,6 +274,15 @@
|
|||||||
path = Network;
|
path = Network;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
92E1EF545807CF318620FEAA /* Audio */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
5C45D1EB09E045A53A154136 /* MMAudioTelemetryProvider.h */,
|
||||||
|
3189D2403E6E984D4924AE4D /* MMAudioTelemetryProvider.m */,
|
||||||
|
);
|
||||||
|
path = Audio;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
9844EC526E3527F6A582179F /* Hardware */ = {
|
9844EC526E3527F6A582179F /* Hardware */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -303,6 +333,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
2EC3EDFCD5C50CB352FCED87 /* MacMonitorTests.swift */,
|
2EC3EDFCD5C50CB352FCED87 /* MacMonitorTests.swift */,
|
||||||
|
10D16E1ABE6D28B676EA83FF /* MMAudioTests.swift */,
|
||||||
B0EB61D811D989279BCBE478 /* MMBatteryTests.swift */,
|
B0EB61D811D989279BCBE478 /* MMBatteryTests.swift */,
|
||||||
B288C7402E2C00E75F8CD016 /* MMComponentThermalTests.swift */,
|
B288C7402E2C00E75F8CD016 /* MMComponentThermalTests.swift */,
|
||||||
4CE92B1A8D7FDBB6499448E1 /* MMCPULoadTests.swift */,
|
4CE92B1A8D7FDBB6499448E1 /* MMCPULoadTests.swift */,
|
||||||
@@ -315,6 +346,7 @@
|
|||||||
099DCF7EF03A58ADA40A94A1 /* MMMemoryTests.swift */,
|
099DCF7EF03A58ADA40A94A1 /* MMMemoryTests.swift */,
|
||||||
27C612287333D757C92A076A /* MMNetworkBandwidthTests.swift */,
|
27C612287333D757C92A076A /* MMNetworkBandwidthTests.swift */,
|
||||||
374B1BF631CC4738CB52CA3B /* MMNetworkSocketsTests.swift */,
|
374B1BF631CC4738CB52CA3B /* MMNetworkSocketsTests.swift */,
|
||||||
|
D1486E1512594482380CB492 /* MMPeripheralsTests.swift */,
|
||||||
D48698681374BD25B980C000 /* MMPowerTests.swift */,
|
D48698681374BD25B980C000 /* MMPowerTests.swift */,
|
||||||
7187632FF63B3B0D07FE9194 /* MMProcessDetailsTests.swift */,
|
7187632FF63B3B0D07FE9194 /* MMProcessDetailsTests.swift */,
|
||||||
52471E871E5CC1E444318070 /* MMProcessTests.swift */,
|
52471E871E5CC1E444318070 /* MMProcessTests.swift */,
|
||||||
@@ -458,6 +490,7 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
9D12825C7904FB0DAE664CA0 /* MMAudioTests.swift in Sources */,
|
||||||
BC487DB86227F09CB0603894 /* MMBatteryTests.swift in Sources */,
|
BC487DB86227F09CB0603894 /* MMBatteryTests.swift in Sources */,
|
||||||
160334CC765E091A7CBE21AA /* MMCPULoadTests.swift in Sources */,
|
160334CC765E091A7CBE21AA /* MMCPULoadTests.swift in Sources */,
|
||||||
87818E46CEA5145A8215D0E3 /* MMCPUThermalTests.swift in Sources */,
|
87818E46CEA5145A8215D0E3 /* MMCPUThermalTests.swift in Sources */,
|
||||||
@@ -470,6 +503,7 @@
|
|||||||
6201FD599FED061F6C736E8B /* MMMemoryTests.swift in Sources */,
|
6201FD599FED061F6C736E8B /* MMMemoryTests.swift in Sources */,
|
||||||
5D31906EA986E2BA92E86FA8 /* MMNetworkBandwidthTests.swift in Sources */,
|
5D31906EA986E2BA92E86FA8 /* MMNetworkBandwidthTests.swift in Sources */,
|
||||||
4C1A92F4DEF4C824976115C2 /* MMNetworkSocketsTests.swift in Sources */,
|
4C1A92F4DEF4C824976115C2 /* MMNetworkSocketsTests.swift in Sources */,
|
||||||
|
22CA7351A745F7837E487051 /* MMPeripheralsTests.swift in Sources */,
|
||||||
9B5C651AD2AF7DE2738F0C44 /* MMPowerTests.swift in Sources */,
|
9B5C651AD2AF7DE2738F0C44 /* MMPowerTests.swift in Sources */,
|
||||||
3BA6709B727B1AAC6C4310B5 /* MMProcessDetailsTests.swift in Sources */,
|
3BA6709B727B1AAC6C4310B5 /* MMProcessDetailsTests.swift in Sources */,
|
||||||
7C9AE2ADAED52E593B52F3AE /* MMProcessTests.swift in Sources */,
|
7C9AE2ADAED52E593B52F3AE /* MMProcessTests.swift in Sources */,
|
||||||
@@ -485,6 +519,7 @@
|
|||||||
files = (
|
files = (
|
||||||
A9FCAEC0BF27A419DB148C4A /* ContentView.swift in Sources */,
|
A9FCAEC0BF27A419DB148C4A /* ContentView.swift in Sources */,
|
||||||
CD91FC663B19DA1FEA3D49D7 /* MMAppleSMCClient.m in Sources */,
|
CD91FC663B19DA1FEA3D49D7 /* MMAppleSMCClient.m in Sources */,
|
||||||
|
D7784A61FE4635275CFB3D6C /* MMAudioTelemetryProvider.m in Sources */,
|
||||||
8EDDC2171C55B6E7FC999DAB /* MMBatteryTelemetryProvider.m in Sources */,
|
8EDDC2171C55B6E7FC999DAB /* MMBatteryTelemetryProvider.m in Sources */,
|
||||||
4419FE7554489B23976E2970 /* MMCPULoadProvider.m in Sources */,
|
4419FE7554489B23976E2970 /* MMCPULoadProvider.m in Sources */,
|
||||||
87A9E18362486D0D385BBC4A /* MMCPUThermalProvider.m in Sources */,
|
87A9E18362486D0D385BBC4A /* MMCPUThermalProvider.m in Sources */,
|
||||||
@@ -497,6 +532,7 @@
|
|||||||
B9C2D6574E808B517BA34C83 /* MMMemoryTelemetryProvider.m in Sources */,
|
B9C2D6574E808B517BA34C83 /* MMMemoryTelemetryProvider.m in Sources */,
|
||||||
E3CCE93A7D4D1EB0187D3E52 /* MMNetworkBandwidthProvider.m in Sources */,
|
E3CCE93A7D4D1EB0187D3E52 /* MMNetworkBandwidthProvider.m in Sources */,
|
||||||
A599E974E56F0B8D94A7E480 /* MMNetworkSocketsProvider.m in Sources */,
|
A599E974E56F0B8D94A7E480 /* MMNetworkSocketsProvider.m in Sources */,
|
||||||
|
4752C49841375B88194F7635 /* MMPeripheralsProvider.m in Sources */,
|
||||||
0A7117B3B7CC7112F2527574 /* MMPowerTelemetryProvider.m in Sources */,
|
0A7117B3B7CC7112F2527574 /* MMPowerTelemetryProvider.m in Sources */,
|
||||||
2C0F7AB93691ED8AA86FBCF0 /* MMProcessDetailInspector.m in Sources */,
|
2C0F7AB93691ED8AA86FBCF0 /* MMProcessDetailInspector.m in Sources */,
|
||||||
93EF83FE087C6DEAAE3EC0CC /* MMProcessTelemetryProvider.m in Sources */,
|
93EF83FE087C6DEAAE3EC0CC /* MMProcessTelemetryProvider.m in Sources */,
|
||||||
|
|||||||
@@ -81,6 +81,143 @@ public struct PowerMetrics: Sendable {
|
|||||||
public var sensorReadings: [(key: String, name: String, value: Double, unit: String)] = []
|
public var sensorReadings: [(key: String, name: String, value: Double, unit: String)] = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Milestone 3 Advanced Telemetry Models
|
||||||
|
|
||||||
|
public struct KernelCountersMetrics: Sendable {
|
||||||
|
public var contextSwitchesPerSec: Double = 0
|
||||||
|
public var syscallsPerSec: Double = 0
|
||||||
|
public var pageFaultsPerSec: Double = 0
|
||||||
|
public var cowFaultsPerSec: Double = 0
|
||||||
|
public var zeroFillFaultsPerSec: Double = 0
|
||||||
|
public var pageinsPerSec: Double = 0
|
||||||
|
public var pageoutsPerSec: Double = 0
|
||||||
|
public var totalContextSwitches: UInt64 = 0
|
||||||
|
public var totalSyscalls: UInt64 = 0
|
||||||
|
public var totalPageFaults: UInt64 = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct SystemLoadMetrics: Sendable {
|
||||||
|
public var load1Min: Double = 0
|
||||||
|
public var load5Min: Double = 0
|
||||||
|
public var load15Min: Double = 0
|
||||||
|
public var taskCount: Int = 0
|
||||||
|
public var threadCount: Int = 0
|
||||||
|
public var machFactor: Double = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct DiskIOItem: Identifiable, Sendable {
|
||||||
|
public var id: String { bsdName }
|
||||||
|
public let bsdName: String
|
||||||
|
public let readBps: Double
|
||||||
|
public let writeBps: Double
|
||||||
|
public let readIOPS: Double
|
||||||
|
public let writeIOPS: Double
|
||||||
|
public let totalBytesRead: UInt64
|
||||||
|
public let totalBytesWritten: UInt64
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct NetworkBandwidthItem: Identifiable, Sendable {
|
||||||
|
public var id: String { interfaceName }
|
||||||
|
public let interfaceName: String
|
||||||
|
public let ipAddress: String
|
||||||
|
public let isUp: Bool
|
||||||
|
public let downloadBps: Double
|
||||||
|
public let uploadBps: Double
|
||||||
|
public let downloadPps: Double
|
||||||
|
public let uploadPps: Double
|
||||||
|
public let totalBytesIn: UInt64
|
||||||
|
public let totalBytesOut: UInt64
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct SocketItem: Identifiable, Sendable {
|
||||||
|
public var id: String { "\(pid)_\(fd)_\(localAddress):\(localPort)" }
|
||||||
|
public let pid: Int32
|
||||||
|
public let fd: Int32
|
||||||
|
public let processName: String
|
||||||
|
public let protocolName: String
|
||||||
|
public let localAddress: String
|
||||||
|
public let localPort: UInt16
|
||||||
|
public let remoteAddress: String
|
||||||
|
public let remotePort: UInt16
|
||||||
|
public let tcpState: String
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct ProcessItem: Identifiable, Sendable {
|
||||||
|
public var id: Int32 { pid }
|
||||||
|
public let pid: Int32
|
||||||
|
public let ppid: Int32
|
||||||
|
public let name: String
|
||||||
|
public let cpuPercent: Double
|
||||||
|
public let residentSize: UInt64
|
||||||
|
public let virtualSize: UInt64
|
||||||
|
public let threadCount: Int32
|
||||||
|
public let uid: UInt32
|
||||||
|
public let username: String
|
||||||
|
public let isStopped: Bool
|
||||||
|
public let isZombie: Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct GPUCardItem: Identifiable, Sendable {
|
||||||
|
public var id: String { name }
|
||||||
|
public let name: String
|
||||||
|
public let isDiscrete: Bool
|
||||||
|
public let isLowPower: Bool
|
||||||
|
public let vramTotalBytes: UInt64
|
||||||
|
public let vramUsedBytes: UInt64
|
||||||
|
public let utilizationPercent: Double
|
||||||
|
public let temperature: Double
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct BatteryHealthMetrics: Sendable {
|
||||||
|
public var hasBattery: Bool = false
|
||||||
|
public var installed: Bool = false
|
||||||
|
public var healthCondition: String = "Normal"
|
||||||
|
public var healthPercent: Double = 100.0
|
||||||
|
public var cycleCount: Int = 0
|
||||||
|
public var designCycleCount: Int = 1000
|
||||||
|
public var currentCapacity: Int = 0
|
||||||
|
public var maxCapacity: Int = 0
|
||||||
|
public var designCapacity: Int = 0
|
||||||
|
public var temperature: Double = 0
|
||||||
|
public var voltage: Double = 0
|
||||||
|
public var amperage: Double = 0
|
||||||
|
public var watts: Double = 0
|
||||||
|
public var isCharging: Bool = false
|
||||||
|
public var isCharged: Bool = false
|
||||||
|
public var externalConnected: Bool = false
|
||||||
|
public var timeRemainingMinutes: Int = -1
|
||||||
|
public var manufacturer: String = "Apple"
|
||||||
|
public var serial: String = ""
|
||||||
|
public var adapterWatts: Int = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct PeripheralDeviceItem: Identifiable, Sendable {
|
||||||
|
public var id: String { "\(busType)_\(locationID)_\(name)" }
|
||||||
|
public let name: String
|
||||||
|
public let busType: String
|
||||||
|
public let vendorName: String
|
||||||
|
public let vendorID: UInt32
|
||||||
|
public let productID: UInt32
|
||||||
|
public let serialNumber: String
|
||||||
|
public let locationID: UInt64
|
||||||
|
public let isBuiltIn: Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct AudioDeviceItem: Identifiable, Sendable {
|
||||||
|
public var id: UInt32 { deviceID }
|
||||||
|
public let deviceID: UInt32
|
||||||
|
public let name: String
|
||||||
|
public let manufacturer: String
|
||||||
|
public let isInput: Bool
|
||||||
|
public let isOutput: Bool
|
||||||
|
public let isDefaultInput: Bool
|
||||||
|
public let isDefaultOutput: Bool
|
||||||
|
public let sampleRate: Double
|
||||||
|
public let channelCount: UInt32
|
||||||
|
public let volume: Float
|
||||||
|
public let isMuted: Bool
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - SystemTelemetryStore
|
// MARK: - SystemTelemetryStore
|
||||||
|
|
||||||
@Observable
|
@Observable
|
||||||
@@ -95,7 +232,7 @@ public final class SystemTelemetryStore {
|
|||||||
/// Raw snapshots organized by provider identifier
|
/// Raw snapshots organized by provider identifier
|
||||||
public private(set) var latestSnapshot: [String: [String: Any]] = [:]
|
public private(set) var latestSnapshot: [String: [String: Any]] = [:]
|
||||||
|
|
||||||
/// Structured Telemetry Metrics
|
/// Milestone 2 Structured Metrics
|
||||||
public private(set) var cpuLoad = CPULoadMetrics()
|
public private(set) var cpuLoad = CPULoadMetrics()
|
||||||
public private(set) var memory = MemoryMetrics()
|
public private(set) var memory = MemoryMetrics()
|
||||||
public private(set) var storageVolumes: [StorageVolumeItem] = []
|
public private(set) var storageVolumes: [StorageVolumeItem] = []
|
||||||
@@ -104,6 +241,21 @@ public final class SystemTelemetryStore {
|
|||||||
public private(set) var componentTemps: [ComponentThermalItem] = []
|
public private(set) var componentTemps: [ComponentThermalItem] = []
|
||||||
public private(set) var power = PowerMetrics()
|
public private(set) var power = PowerMetrics()
|
||||||
|
|
||||||
|
/// Milestone 3 Structured Metrics
|
||||||
|
public private(set) var kernelCounters = KernelCountersMetrics()
|
||||||
|
public private(set) var systemLoad = SystemLoadMetrics()
|
||||||
|
public private(set) var diskIO: [DiskIOItem] = []
|
||||||
|
public private(set) var networkBandwidth: [NetworkBandwidthItem] = []
|
||||||
|
public private(set) var networkSockets: [SocketItem] = []
|
||||||
|
public private(set) var processes: [ProcessItem] = []
|
||||||
|
public private(set) var gpus: [GPUCardItem] = []
|
||||||
|
public private(set) var batteryHealth = BatteryHealthMetrics()
|
||||||
|
public private(set) var peripherals: [PeripheralDeviceItem] = []
|
||||||
|
public private(set) var audioDevices: [AudioDeviceItem] = []
|
||||||
|
|
||||||
|
/// Process detail inspection helper
|
||||||
|
public let processInspector = MMProcessDetailInspector()
|
||||||
|
|
||||||
/// System identification
|
/// System identification
|
||||||
public let hostModel: String
|
public let hostModel: String
|
||||||
public let osVersion: String
|
public let osVersion: String
|
||||||
@@ -125,7 +277,7 @@ public final class SystemTelemetryStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func registerDefaultProviders() {
|
private func registerDefaultProviders() {
|
||||||
// Register all Primary System & Thermal Telemetry providers (M2)
|
// Milestone 2 Primary System & Thermal Telemetry
|
||||||
coordinator.register(MMCPULoadProvider())
|
coordinator.register(MMCPULoadProvider())
|
||||||
coordinator.register(MMMemoryTelemetryProvider())
|
coordinator.register(MMMemoryTelemetryProvider())
|
||||||
coordinator.register(MMStorageTelemetryProvider())
|
coordinator.register(MMStorageTelemetryProvider())
|
||||||
@@ -133,6 +285,18 @@ public final class SystemTelemetryStore {
|
|||||||
coordinator.register(MMFanTelemetryProvider())
|
coordinator.register(MMFanTelemetryProvider())
|
||||||
coordinator.register(MMComponentThermalProvider())
|
coordinator.register(MMComponentThermalProvider())
|
||||||
coordinator.register(MMPowerTelemetryProvider())
|
coordinator.register(MMPowerTelemetryProvider())
|
||||||
|
|
||||||
|
// Milestone 3 Advanced Kernel, Process & Peripheral Telemetry
|
||||||
|
coordinator.register(MMKernelTelemetryProvider())
|
||||||
|
coordinator.register(MMLoadAverageProvider())
|
||||||
|
coordinator.register(MMDiskIOProvider())
|
||||||
|
coordinator.register(MMNetworkBandwidthProvider())
|
||||||
|
coordinator.register(MMNetworkSocketsProvider())
|
||||||
|
coordinator.register(MMProcessTelemetryProvider())
|
||||||
|
coordinator.register(MMGPUTelemetryProvider())
|
||||||
|
coordinator.register(MMBatteryTelemetryProvider())
|
||||||
|
coordinator.register(MMPeripheralsProvider())
|
||||||
|
coordinator.register(MMAudioTelemetryProvider())
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupCoordinator() {
|
private func setupCoordinator() {
|
||||||
@@ -178,7 +342,7 @@ public final class SystemTelemetryStore {
|
|||||||
self.memory = m
|
self.memory = m
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Storage
|
// 3. Storage Volumes
|
||||||
if let stgDict = snapshot["com.i3omb.macmonitor.telemetry.storage"],
|
if let stgDict = snapshot["com.i3omb.macmonitor.telemetry.storage"],
|
||||||
let volArray = stgDict["volumes"] as? [[String: Any]] {
|
let volArray = stgDict["volumes"] as? [[String: Any]] {
|
||||||
self.storageVolumes = volArray.compactMap { dict in
|
self.storageVolumes = volArray.compactMap { dict in
|
||||||
@@ -269,6 +433,230 @@ public final class SystemTelemetryStore {
|
|||||||
}
|
}
|
||||||
self.power = m
|
self.power = m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 8. Kernel Counters
|
||||||
|
if let kDict = snapshot["com.i3omb.macmonitor.telemetry.kernel"] {
|
||||||
|
var m = KernelCountersMetrics()
|
||||||
|
m.contextSwitchesPerSec = (kDict["contextSwitchesPerSec"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.syscallsPerSec = (kDict["syscallsPerSec"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.pageFaultsPerSec = (kDict["pageFaultsPerSec"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.cowFaultsPerSec = (kDict["cowFaultsPerSec"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.zeroFillFaultsPerSec = (kDict["zeroFillFaultsPerSec"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.pageinsPerSec = (kDict["pageinsPerSec"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.pageoutsPerSec = (kDict["pageoutsPerSec"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.totalContextSwitches = (kDict["totalContextSwitches"] as? NSNumber)?.uint64Value ?? 0
|
||||||
|
m.totalSyscalls = (kDict["totalSyscalls"] as? NSNumber)?.uint64Value ?? 0
|
||||||
|
m.totalPageFaults = (kDict["totalPageFaults"] as? NSNumber)?.uint64Value ?? 0
|
||||||
|
self.kernelCounters = m
|
||||||
|
}
|
||||||
|
|
||||||
|
// 9. System Load Average & Mach Factor
|
||||||
|
if let loadDict = snapshot["com.i3omb.macmonitor.telemetry.systemload"] {
|
||||||
|
var m = SystemLoadMetrics()
|
||||||
|
m.load1Min = (loadDict["load1Min"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.load5Min = (loadDict["load5Min"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.load15Min = (loadDict["load15Min"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.taskCount = (loadDict["taskCount"] as? NSNumber)?.intValue ?? 0
|
||||||
|
m.threadCount = (loadDict["threadCount"] as? NSNumber)?.intValue ?? 0
|
||||||
|
m.machFactor = (loadDict["machFactor"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
self.systemLoad = m
|
||||||
|
}
|
||||||
|
|
||||||
|
// 10. Disk I/O & IOPS
|
||||||
|
if let diskDict = snapshot["com.i3omb.macmonitor.telemetry.diskio"],
|
||||||
|
let disks = diskDict["disks"] as? [[String: Any]] {
|
||||||
|
self.diskIO = disks.compactMap { d in
|
||||||
|
guard let bsd = d["bsdName"] as? String else { return nil }
|
||||||
|
return DiskIOItem(
|
||||||
|
bsdName: bsd,
|
||||||
|
readBps: (d["readBps"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
writeBps: (d["writeBps"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
readIOPS: (d["readIOPS"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
writeIOPS: (d["writeIOPS"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
totalBytesRead: (d["totalBytesRead"] as? NSNumber)?.uint64Value ?? 0,
|
||||||
|
totalBytesWritten: (d["totalBytesWritten"] as? NSNumber)?.uint64Value ?? 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 11. Network Bandwidth
|
||||||
|
if let netDict = snapshot["com.i3omb.macmonitor.telemetry.network.bandwidth"],
|
||||||
|
let ifaces = netDict["interfaces"] as? [[String: Any]] {
|
||||||
|
self.networkBandwidth = ifaces.compactMap { d in
|
||||||
|
guard let name = d["interfaceName"] as? String else { return nil }
|
||||||
|
return NetworkBandwidthItem(
|
||||||
|
interfaceName: name,
|
||||||
|
ipAddress: d["ipAddress"] as? String ?? "",
|
||||||
|
isUp: (d["isUp"] as? NSNumber)?.boolValue ?? false,
|
||||||
|
downloadBps: (d["downloadBps"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
uploadBps: (d["uploadBps"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
downloadPps: (d["downloadPps"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
uploadPps: (d["uploadPps"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
totalBytesIn: (d["totalBytesIn"] as? NSNumber)?.uint64Value ?? 0,
|
||||||
|
totalBytesOut: (d["totalBytesOut"] as? NSNumber)?.uint64Value ?? 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 12. Network Sockets
|
||||||
|
if let sockDict = snapshot["com.i3omb.macmonitor.telemetry.network.sockets"],
|
||||||
|
let socks = sockDict["sockets"] as? [[String: Any]] {
|
||||||
|
self.networkSockets = socks.compactMap { d in
|
||||||
|
let pid = (d["pid"] as? NSNumber)?.int32Value ?? 0
|
||||||
|
let fd = (d["fd"] as? NSNumber)?.int32Value ?? 0
|
||||||
|
return SocketItem(
|
||||||
|
pid: pid,
|
||||||
|
fd: fd,
|
||||||
|
processName: d["processName"] as? String ?? "",
|
||||||
|
protocolName: d["protocol"] as? String ?? "TCP",
|
||||||
|
localAddress: d["localAddress"] as? String ?? "*",
|
||||||
|
localPort: (d["localPort"] as? NSNumber)?.uint16Value ?? 0,
|
||||||
|
remoteAddress: d["remoteAddress"] as? String ?? "*",
|
||||||
|
remotePort: (d["remotePort"] as? NSNumber)?.uint16Value ?? 0,
|
||||||
|
tcpState: d["tcpState"] as? String ?? "ESTABLISHED"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 13. Processes
|
||||||
|
if let procDict = snapshot["com.i3omb.macmonitor.telemetry.process"],
|
||||||
|
let procs = procDict["processes"] as? [[String: Any]] {
|
||||||
|
self.processes = procs.compactMap { d in
|
||||||
|
guard let pid = (d["pid"] as? NSNumber)?.int32Value else { return nil }
|
||||||
|
return ProcessItem(
|
||||||
|
pid: pid,
|
||||||
|
ppid: (d["ppid"] as? NSNumber)?.int32Value ?? 0,
|
||||||
|
name: d["name"] as? String ?? "Unknown",
|
||||||
|
cpuPercent: (d["cpuPercent"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
residentSize: (d["residentSize"] as? NSNumber)?.uint64Value ?? 0,
|
||||||
|
virtualSize: (d["virtualSize"] as? NSNumber)?.uint64Value ?? 0,
|
||||||
|
threadCount: (d["threadCount"] as? NSNumber)?.int32Value ?? 1,
|
||||||
|
uid: (d["uid"] as? NSNumber)?.uint32Value ?? 0,
|
||||||
|
username: d["username"] as? String ?? "",
|
||||||
|
isStopped: (d["isStopped"] as? NSNumber)?.boolValue ?? false,
|
||||||
|
isZombie: (d["isZombie"] as? NSNumber)?.boolValue ?? false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 14. GPU Telemetry
|
||||||
|
if let gpuDict = snapshot["com.i3omb.macmonitor.telemetry.gpu"],
|
||||||
|
let cards = gpuDict["gpus"] as? [[String: Any]] {
|
||||||
|
self.gpus = cards.compactMap { d in
|
||||||
|
guard let name = d["name"] as? String else { return nil }
|
||||||
|
return GPUCardItem(
|
||||||
|
name: name,
|
||||||
|
isDiscrete: (d["isDiscrete"] as? NSNumber)?.boolValue ?? false,
|
||||||
|
isLowPower: (d["isLowPower"] as? NSNumber)?.boolValue ?? false,
|
||||||
|
vramTotalBytes: (d["vramTotalBytes"] as? NSNumber)?.uint64Value ?? 0,
|
||||||
|
vramUsedBytes: (d["vramUsedBytes"] as? NSNumber)?.uint64Value ?? 0,
|
||||||
|
utilizationPercent: (d["utilizationPercent"] as? NSNumber)?.doubleValue ?? 0,
|
||||||
|
temperature: (d["temperature"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 15. Battery Health
|
||||||
|
if let battDict = snapshot["com.i3omb.macmonitor.telemetry.battery"] {
|
||||||
|
var m = BatteryHealthMetrics()
|
||||||
|
m.hasBattery = (battDict["hasBattery"] as? NSNumber)?.boolValue ?? false
|
||||||
|
m.installed = (battDict["installed"] as? NSNumber)?.boolValue ?? false
|
||||||
|
m.healthCondition = battDict["healthCondition"] as? String ?? "Normal"
|
||||||
|
m.healthPercent = (battDict["healthPercent"] as? NSNumber)?.doubleValue ?? 100.0
|
||||||
|
m.cycleCount = (battDict["cycleCount"] as? NSNumber)?.intValue ?? 0
|
||||||
|
m.designCycleCount = (battDict["designCycleCount"] as? NSNumber)?.intValue ?? 1000
|
||||||
|
m.currentCapacity = (battDict["currentCapacity"] as? NSNumber)?.intValue ?? 0
|
||||||
|
m.maxCapacity = (battDict["maxCapacity"] as? NSNumber)?.intValue ?? 0
|
||||||
|
m.designCapacity = (battDict["designCapacity"] as? NSNumber)?.intValue ?? 0
|
||||||
|
m.temperature = (battDict["temperature"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.voltage = (battDict["voltage"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.amperage = (battDict["amperage"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.watts = (battDict["watts"] as? NSNumber)?.doubleValue ?? 0
|
||||||
|
m.isCharging = (battDict["isCharging"] as? NSNumber)?.boolValue ?? false
|
||||||
|
m.isCharged = (battDict["isCharged"] as? NSNumber)?.boolValue ?? false
|
||||||
|
m.externalConnected = (battDict["externalConnected"] as? NSNumber)?.boolValue ?? false
|
||||||
|
m.timeRemainingMinutes = (battDict["timeRemainingMinutes"] as? NSNumber)?.intValue ?? -1
|
||||||
|
m.manufacturer = battDict["manufacturer"] as? String ?? "Apple"
|
||||||
|
m.serial = battDict["serial"] as? String ?? ""
|
||||||
|
m.adapterWatts = (battDict["adapterWatts"] as? NSNumber)?.intValue ?? 0
|
||||||
|
self.batteryHealth = m
|
||||||
|
}
|
||||||
|
|
||||||
|
// 16. Connected Peripherals
|
||||||
|
if let periphDict = snapshot["com.i3omb.macmonitor.telemetry.peripherals"] {
|
||||||
|
var allDevs: [PeripheralDeviceItem] = []
|
||||||
|
if let usb = periphDict["usbDevices"] as? [[String: Any]] {
|
||||||
|
allDevs.append(contentsOf: usb.compactMap { d in
|
||||||
|
guard let name = d["name"] as? String else { return nil }
|
||||||
|
return PeripheralDeviceItem(
|
||||||
|
name: name,
|
||||||
|
busType: "USB",
|
||||||
|
vendorName: d["vendorName"] as? String ?? "",
|
||||||
|
vendorID: (d["vendorID"] as? NSNumber)?.uint32Value ?? 0,
|
||||||
|
productID: (d["productID"] as? NSNumber)?.uint32Value ?? 0,
|
||||||
|
serialNumber: d["serialNumber"] as? String ?? "",
|
||||||
|
locationID: (d["locationID"] as? NSNumber)?.uint64Value ?? 0,
|
||||||
|
isBuiltIn: (d["isBuiltIn"] as? NSNumber)?.boolValue ?? false
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if let tb = periphDict["thunderboltDevices"] as? [[String: Any]] {
|
||||||
|
allDevs.append(contentsOf: tb.compactMap { d in
|
||||||
|
guard let name = d["name"] as? String else { return nil }
|
||||||
|
return PeripheralDeviceItem(
|
||||||
|
name: name,
|
||||||
|
busType: "Thunderbolt",
|
||||||
|
vendorName: d["vendorName"] as? String ?? "",
|
||||||
|
vendorID: (d["vendorID"] as? NSNumber)?.uint32Value ?? 0,
|
||||||
|
productID: (d["productID"] as? NSNumber)?.uint32Value ?? 0,
|
||||||
|
serialNumber: "",
|
||||||
|
locationID: 0,
|
||||||
|
isBuiltIn: false
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if let pci = periphDict["pciDevices"] as? [[String: Any]] {
|
||||||
|
allDevs.append(contentsOf: pci.compactMap { d in
|
||||||
|
guard let name = d["name"] as? String else { return nil }
|
||||||
|
return PeripheralDeviceItem(
|
||||||
|
name: name,
|
||||||
|
busType: "PCI",
|
||||||
|
vendorName: "Apple / Intel",
|
||||||
|
vendorID: (d["vendorID"] as? NSNumber)?.uint32Value ?? 0,
|
||||||
|
productID: (d["productID"] as? NSNumber)?.uint32Value ?? 0,
|
||||||
|
serialNumber: "",
|
||||||
|
locationID: 0,
|
||||||
|
isBuiltIn: true
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
self.peripherals = allDevs
|
||||||
|
}
|
||||||
|
|
||||||
|
// 17. Audio Devices
|
||||||
|
if let audioDict = snapshot["com.i3omb.macmonitor.telemetry.audio"],
|
||||||
|
let devs = audioDict["devices"] as? [[String: Any]] {
|
||||||
|
self.audioDevices = devs.compactMap { d in
|
||||||
|
guard let devID = (d["deviceID"] as? NSNumber)?.uint32Value else { return nil }
|
||||||
|
return AudioDeviceItem(
|
||||||
|
deviceID: devID,
|
||||||
|
name: d["name"] as? String ?? "Audio Device",
|
||||||
|
manufacturer: d["manufacturer"] as? String ?? "Apple Inc.",
|
||||||
|
isInput: (d["isInput"] as? NSNumber)?.boolValue ?? false,
|
||||||
|
isOutput: (d["isOutput"] as? NSNumber)?.boolValue ?? false,
|
||||||
|
isDefaultInput: (d["isDefaultInput"] as? NSNumber)?.boolValue ?? false,
|
||||||
|
isDefaultOutput: (d["isDefaultOutput"] as? NSNumber)?.boolValue ?? false,
|
||||||
|
sampleRate: (d["sampleRate"] as? NSNumber)?.doubleValue ?? 44100.0,
|
||||||
|
channelCount: (d["channelCount"] as? NSNumber)?.uint32Value ?? 2,
|
||||||
|
volume: (d["volume"] as? NSNumber)?.floatValue ?? 0,
|
||||||
|
isMuted: (d["isMuted"] as? NSNumber)?.boolValue ?? false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func terminateProcess(pid: pid_t, force: Bool) -> Bool {
|
||||||
|
return MMProcessTelemetryProvider.terminateProcess(withPID: pid, force: force)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func start() {
|
public func start() {
|
||||||
|
|||||||
@@ -28,5 +28,7 @@
|
|||||||
#import "MMProcessDetailInspector.h"
|
#import "MMProcessDetailInspector.h"
|
||||||
#import "MMGPUTelemetryProvider.h"
|
#import "MMGPUTelemetryProvider.h"
|
||||||
#import "MMBatteryTelemetryProvider.h"
|
#import "MMBatteryTelemetryProvider.h"
|
||||||
|
#import "MMPeripheralsProvider.h"
|
||||||
|
#import "MMAudioTelemetryProvider.h"
|
||||||
|
|
||||||
#endif /* MacMonitor_Bridging_Header_h */
|
#endif /* MacMonitor_Bridging_Header_h */
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// MMAudioTelemetryProvider.h
|
||||||
|
// MacMonitor
|
||||||
|
//
|
||||||
|
// Telemetry provider enumerating CoreAudio input/output devices, sample rates, volume, and active status.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "MMTelemetryProvider.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface MMAudioDevice : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic, assign) uint32_t deviceID;
|
||||||
|
@property (nonatomic, copy) NSString *name;
|
||||||
|
@property (nonatomic, copy) NSString *manufacturer;
|
||||||
|
@property (nonatomic, copy) NSString *uid;
|
||||||
|
@property (nonatomic, assign) BOOL isInput;
|
||||||
|
@property (nonatomic, assign) BOOL isOutput;
|
||||||
|
@property (nonatomic, assign) BOOL isDefaultInput;
|
||||||
|
@property (nonatomic, assign) BOOL isDefaultOutput;
|
||||||
|
@property (nonatomic, assign) double sampleRate;
|
||||||
|
@property (nonatomic, assign) uint32_t channelCount;
|
||||||
|
@property (nonatomic, assign) float volume;
|
||||||
|
@property (nonatomic, assign) BOOL isMuted;
|
||||||
|
|
||||||
|
- (NSDictionary<NSString *, id> *)toDictionary;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface MMAudioTelemetryProvider : NSObject <MMTelemetryProvider>
|
||||||
|
|
||||||
|
- (instancetype)init;
|
||||||
|
|
||||||
|
+ (NSArray<MMAudioDevice *> *)sampleAudioDevices;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
//
|
||||||
|
// MMAudioTelemetryProvider.m
|
||||||
|
// MacMonitor
|
||||||
|
//
|
||||||
|
// Telemetry provider enumerating CoreAudio input/output devices, sample rates, volume, and active status.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MMAudioTelemetryProvider.h"
|
||||||
|
#import <CoreAudio/CoreAudio.h>
|
||||||
|
|
||||||
|
@implementation MMAudioDevice
|
||||||
|
|
||||||
|
- (NSDictionary<NSString *, id> *)toDictionary {
|
||||||
|
return @{
|
||||||
|
@"deviceID": @(self.deviceID),
|
||||||
|
@"name": self.name ?: @"Unknown Audio Device",
|
||||||
|
@"manufacturer": self.manufacturer ?: @"Unknown",
|
||||||
|
@"uid": self.uid ?: @"",
|
||||||
|
@"isInput": @(self.isInput),
|
||||||
|
@"isOutput": @(self.isOutput),
|
||||||
|
@"isDefaultInput": @(self.isDefaultInput),
|
||||||
|
@"isDefaultOutput": @(self.isDefaultOutput),
|
||||||
|
@"sampleRate": @(self.sampleRate),
|
||||||
|
@"channelCount": @(self.channelCount),
|
||||||
|
@"volume": @(roundf(self.volume * 100.0f) / 100.0f),
|
||||||
|
@"isMuted": @(self.isMuted)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation MMAudioTelemetryProvider
|
||||||
|
|
||||||
|
- (instancetype)init {
|
||||||
|
self = [super init];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (MMTelemetryDomain)domain {
|
||||||
|
return MMTelemetryDomainAudio;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)providerIdentifier {
|
||||||
|
return @"com.i3omb.macmonitor.telemetry.audio";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isAvailable {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (AudioDeviceID)defaultDeviceForProperty:(AudioObjectPropertySelector)selector {
|
||||||
|
AudioObjectPropertyAddress address = {
|
||||||
|
.mSelector = selector,
|
||||||
|
.mScope = kAudioObjectPropertyScopeGlobal,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
AudioDeviceID deviceID = kAudioObjectUnknown;
|
||||||
|
UInt32 size = sizeof(AudioDeviceID);
|
||||||
|
OSStatus status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &address, 0, NULL, &size, &deviceID);
|
||||||
|
if (status == noErr) {
|
||||||
|
return deviceID;
|
||||||
|
}
|
||||||
|
return kAudioObjectUnknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSArray<MMAudioDevice *> *)sampleAudioDevices {
|
||||||
|
AudioObjectPropertyAddress address = {
|
||||||
|
.mSelector = kAudioHardwarePropertyDevices,
|
||||||
|
.mScope = kAudioObjectPropertyScopeGlobal,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
|
||||||
|
UInt32 dataSize = 0;
|
||||||
|
OSStatus status = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &address, 0, NULL, &dataSize);
|
||||||
|
if (status != noErr || dataSize == 0) {
|
||||||
|
return @[];
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt32 deviceCount = dataSize / sizeof(AudioDeviceID);
|
||||||
|
AudioDeviceID *deviceIDs = (AudioDeviceID *)malloc(dataSize);
|
||||||
|
if (!deviceIDs) return @[];
|
||||||
|
|
||||||
|
status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &address, 0, NULL, &dataSize, deviceIDs);
|
||||||
|
if (status != noErr) {
|
||||||
|
free(deviceIDs);
|
||||||
|
return @[];
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioDeviceID defaultIn = [self defaultDeviceForProperty:kAudioHardwarePropertyDefaultInputDevice];
|
||||||
|
AudioDeviceID defaultOut = [self defaultDeviceForProperty:kAudioHardwarePropertyDefaultOutputDevice];
|
||||||
|
|
||||||
|
NSMutableArray<MMAudioDevice *> *devices = [NSMutableArray arrayWithCapacity:deviceCount];
|
||||||
|
|
||||||
|
for (UInt32 i = 0; i < deviceCount; i++) {
|
||||||
|
AudioDeviceID devID = deviceIDs[i];
|
||||||
|
|
||||||
|
// Name
|
||||||
|
CFStringRef nameRef = NULL;
|
||||||
|
UInt32 propSize = sizeof(CFStringRef);
|
||||||
|
AudioObjectPropertyAddress nameAddr = {
|
||||||
|
.mSelector = kAudioObjectPropertyName,
|
||||||
|
.mScope = kAudioObjectPropertyScopeGlobal,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
NSString *name = @"Audio Device";
|
||||||
|
if (AudioObjectGetPropertyData(devID, &nameAddr, 0, NULL, &propSize, &nameRef) == noErr && nameRef) {
|
||||||
|
name = (__bridge_transfer NSString *)nameRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manufacturer
|
||||||
|
CFStringRef mfrRef = NULL;
|
||||||
|
propSize = sizeof(CFStringRef);
|
||||||
|
AudioObjectPropertyAddress mfrAddr = {
|
||||||
|
.mSelector = kAudioObjectPropertyManufacturer,
|
||||||
|
.mScope = kAudioObjectPropertyScopeGlobal,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
NSString *mfr = @"Apple Inc.";
|
||||||
|
if (AudioObjectGetPropertyData(devID, &mfrAddr, 0, NULL, &propSize, &mfrRef) == noErr && mfrRef) {
|
||||||
|
mfr = (__bridge_transfer NSString *)mfrRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UID
|
||||||
|
CFStringRef uidRef = NULL;
|
||||||
|
propSize = sizeof(CFStringRef);
|
||||||
|
AudioObjectPropertyAddress uidAddr = {
|
||||||
|
.mSelector = kAudioDevicePropertyDeviceUID,
|
||||||
|
.mScope = kAudioObjectPropertyScopeGlobal,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
NSString *uid = @"";
|
||||||
|
if (AudioObjectGetPropertyData(devID, &uidAddr, 0, NULL, &propSize, &uidRef) == noErr && uidRef) {
|
||||||
|
uid = (__bridge_transfer NSString *)uidRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Channels & Input / Output determination
|
||||||
|
AudioObjectPropertyAddress inputStreamsAddr = {
|
||||||
|
.mSelector = kAudioDevicePropertyStreams,
|
||||||
|
.mScope = kAudioDevicePropertyScopeInput,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
UInt32 inStreamSize = 0;
|
||||||
|
AudioObjectGetPropertyDataSize(devID, &inputStreamsAddr, 0, NULL, &inStreamSize);
|
||||||
|
BOOL isInput = (inStreamSize > 0);
|
||||||
|
|
||||||
|
AudioObjectPropertyAddress outputStreamsAddr = {
|
||||||
|
.mSelector = kAudioDevicePropertyStreams,
|
||||||
|
.mScope = kAudioDevicePropertyScopeOutput,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
UInt32 outStreamSize = 0;
|
||||||
|
AudioObjectGetPropertyDataSize(devID, &outputStreamsAddr, 0, NULL, &outStreamSize);
|
||||||
|
BOOL isOutput = (outStreamSize > 0);
|
||||||
|
|
||||||
|
// Sample rate
|
||||||
|
Float64 sampleRate = 0.0;
|
||||||
|
propSize = sizeof(Float64);
|
||||||
|
AudioObjectPropertyAddress rateAddr = {
|
||||||
|
.mSelector = kAudioDevicePropertyNominalSampleRate,
|
||||||
|
.mScope = kAudioObjectPropertyScopeGlobal,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
AudioObjectGetPropertyData(devID, &rateAddr, 0, NULL, &propSize, &sampleRate);
|
||||||
|
|
||||||
|
// Volume
|
||||||
|
Float32 volume = 0.0f;
|
||||||
|
AudioObjectPropertyScope volScope = isOutput ? kAudioDevicePropertyScopeOutput : kAudioDevicePropertyScopeInput;
|
||||||
|
AudioObjectPropertyAddress volAddr = {
|
||||||
|
.mSelector = kAudioDevicePropertyVolumeScalar,
|
||||||
|
.mScope = volScope,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
propSize = sizeof(Float32);
|
||||||
|
if (AudioObjectHasProperty(devID, &volAddr)) {
|
||||||
|
AudioObjectGetPropertyData(devID, &volAddr, 0, NULL, &propSize, &volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mute status
|
||||||
|
UInt32 mute = 0;
|
||||||
|
AudioObjectPropertyAddress muteAddr = {
|
||||||
|
.mSelector = kAudioDevicePropertyMute,
|
||||||
|
.mScope = volScope,
|
||||||
|
.mElement = kAudioObjectPropertyElementMain
|
||||||
|
};
|
||||||
|
propSize = sizeof(UInt32);
|
||||||
|
if (AudioObjectHasProperty(devID, &muteAddr)) {
|
||||||
|
AudioObjectGetPropertyData(devID, &muteAddr, 0, NULL, &propSize, &mute);
|
||||||
|
}
|
||||||
|
|
||||||
|
MMAudioDevice *device = [[MMAudioDevice alloc] init];
|
||||||
|
device.deviceID = devID;
|
||||||
|
device.name = name;
|
||||||
|
device.manufacturer = mfr;
|
||||||
|
device.uid = uid;
|
||||||
|
device.isInput = isInput;
|
||||||
|
device.isOutput = isOutput;
|
||||||
|
device.isDefaultInput = (devID == defaultIn);
|
||||||
|
device.isDefaultOutput = (devID == defaultOut);
|
||||||
|
device.sampleRate = (double)sampleRate;
|
||||||
|
device.channelCount = (inStreamSize / sizeof(AudioStreamID)) + (outStreamSize / sizeof(AudioStreamID));
|
||||||
|
device.volume = volume;
|
||||||
|
device.isMuted = (mute != 0);
|
||||||
|
|
||||||
|
[devices addObject:device];
|
||||||
|
}
|
||||||
|
|
||||||
|
free(deviceIDs);
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nullable NSDictionary<NSString *, id> *)sampleTelemetryWithError:(NSError **)error {
|
||||||
|
NSArray<MMAudioDevice *> *devices = [MMAudioTelemetryProvider sampleAudioDevices];
|
||||||
|
NSMutableArray<NSDictionary<NSString *, id> *> *deviceList = [NSMutableArray arrayWithCapacity:devices.count];
|
||||||
|
|
||||||
|
MMAudioDevice *defaultIn = nil;
|
||||||
|
MMAudioDevice *defaultOut = nil;
|
||||||
|
|
||||||
|
for (MMAudioDevice *d in devices) {
|
||||||
|
[deviceList addObject:[d toDictionary]];
|
||||||
|
if (d.isDefaultInput) defaultIn = d;
|
||||||
|
if (d.isDefaultOutput) defaultOut = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
return @{
|
||||||
|
@"devices": deviceList,
|
||||||
|
@"deviceCount": @(devices.count),
|
||||||
|
@"defaultInputDevice": defaultIn ? [defaultIn toDictionary] : [NSNull null],
|
||||||
|
@"defaultOutputDevice": defaultOut ? [defaultOut toDictionary] : [NSNull null]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
//
|
||||||
|
// MMPeripheralsProvider.h
|
||||||
|
// MacMonitor
|
||||||
|
//
|
||||||
|
// Telemetry provider enumerating connected USB, Thunderbolt, and PCI peripheral devices via IOKit.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "MMTelemetryProvider.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, MMPeripheralBusType) {
|
||||||
|
MMPeripheralBusTypeUSB,
|
||||||
|
MMPeripheralBusTypeThunderbolt,
|
||||||
|
MMPeripheralBusTypePCI
|
||||||
|
};
|
||||||
|
|
||||||
|
@interface MMPeripheralDevice : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *name;
|
||||||
|
@property (nonatomic, assign) MMPeripheralBusType busType;
|
||||||
|
@property (nonatomic, copy) NSString *vendorName;
|
||||||
|
@property (nonatomic, assign) uint32_t vendorID;
|
||||||
|
@property (nonatomic, assign) uint32_t productID;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *serialNumber;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *deviceClass;
|
||||||
|
@property (nonatomic, assign) uint64_t locationID;
|
||||||
|
@property (nonatomic, assign) BOOL isBuiltIn;
|
||||||
|
|
||||||
|
- (NSDictionary<NSString *, id> *)toDictionary;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface MMPeripheralsProvider : NSObject <MMTelemetryProvider>
|
||||||
|
|
||||||
|
- (instancetype)init;
|
||||||
|
|
||||||
|
+ (NSArray<MMPeripheralDevice *> *)sampleUSBDevices;
|
||||||
|
+ (NSArray<MMPeripheralDevice *> *)sampleThunderboltDevices;
|
||||||
|
+ (NSArray<MMPeripheralDevice *> *)samplePCIDevices;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
//
|
||||||
|
// MMPeripheralsProvider.m
|
||||||
|
// MacMonitor
|
||||||
|
//
|
||||||
|
// Telemetry provider enumerating connected USB, Thunderbolt, and PCI peripheral devices via IOKit.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MMPeripheralsProvider.h"
|
||||||
|
#import <IOKit/IOKitLib.h>
|
||||||
|
|
||||||
|
@implementation MMPeripheralDevice
|
||||||
|
|
||||||
|
- (NSDictionary<NSString *, id> *)toDictionary {
|
||||||
|
NSString *busStr = @"USB";
|
||||||
|
if (self.busType == MMPeripheralBusTypeThunderbolt) {
|
||||||
|
busStr = @"Thunderbolt";
|
||||||
|
} else if (self.busType == MMPeripheralBusTypePCI) {
|
||||||
|
busStr = @"PCI";
|
||||||
|
}
|
||||||
|
|
||||||
|
return @{
|
||||||
|
@"name": self.name ?: @"Unknown Device",
|
||||||
|
@"busType": busStr,
|
||||||
|
@"vendorName": self.vendorName ?: @"Unknown",
|
||||||
|
@"vendorID": @(self.vendorID),
|
||||||
|
@"productID": @(self.productID),
|
||||||
|
@"serialNumber": self.serialNumber ?: @"",
|
||||||
|
@"deviceClass": self.deviceClass ?: @"",
|
||||||
|
@"locationID": @(self.locationID),
|
||||||
|
@"isBuiltIn": @(self.isBuiltIn)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation MMPeripheralsProvider
|
||||||
|
|
||||||
|
- (instancetype)init {
|
||||||
|
self = [super init];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (MMTelemetryDomain)domain {
|
||||||
|
return MMTelemetryDomainPeripherals;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)providerIdentifier {
|
||||||
|
return @"com.i3omb.macmonitor.telemetry.peripherals";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isAvailable {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSArray<MMPeripheralDevice *> *)sampleUSBDevices {
|
||||||
|
NSMutableArray<MMPeripheralDevice *> *devices = [NSMutableArray array];
|
||||||
|
|
||||||
|
// Query both IOUSBHostDevice (macOS modern) and IOUSBDevice (legacy/fallback)
|
||||||
|
const char *classes[] = { "IOUSBHostDevice", "IOUSBDevice" };
|
||||||
|
NSMutableSet<NSNumber *> *seenRegistryIDs = [NSMutableSet set];
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
CFMutableDictionaryRef matching = IOServiceMatching(classes[i]);
|
||||||
|
if (!matching) continue;
|
||||||
|
|
||||||
|
io_iterator_t iterator = IO_OBJECT_NULL;
|
||||||
|
kern_return_t kr = IOServiceGetMatchingServices(kIOMainPortDefault, matching, &iterator);
|
||||||
|
if (kr != KERN_SUCCESS || iterator == IO_OBJECT_NULL) continue;
|
||||||
|
|
||||||
|
io_service_t service = IO_OBJECT_NULL;
|
||||||
|
while ((service = IOIteratorNext(iterator)) != IO_OBJECT_NULL) {
|
||||||
|
uint64_t regID = 0;
|
||||||
|
IORegistryEntryGetRegistryEntryID(service, ®ID);
|
||||||
|
if ([seenRegistryIDs containsObject:@(regID)]) {
|
||||||
|
IOObjectRelease(service);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
[seenRegistryIDs addObject:@(regID)];
|
||||||
|
|
||||||
|
CFMutableDictionaryRef props = NULL;
|
||||||
|
if (IORegistryEntryCreateCFProperties(service, &props, kCFAllocatorDefault, 0) == KERN_SUCCESS && props) {
|
||||||
|
NSDictionary *dict = (__bridge NSDictionary *)props;
|
||||||
|
|
||||||
|
NSString *name = dict[@"USB Product Name"] ?: (dict[@"kUSBProductString"] ?: dict[@"IOName"]);
|
||||||
|
if (!name || name.length == 0) {
|
||||||
|
name = @"USB Device";
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *vendor = dict[@"USB Vendor Name"] ?: (dict[@"kUSBVendorString"] ?: @"");
|
||||||
|
uint32_t vendorID = [dict[@"idVendor"] unsignedIntValue];
|
||||||
|
uint32_t productID = [dict[@"idProduct"] unsignedIntValue];
|
||||||
|
NSString *serial = dict[@"USB Serial Number"] ?: dict[@"kUSBSerialNumberString"];
|
||||||
|
uint64_t locID = [dict[@"locationID"] unsignedLongLongValue];
|
||||||
|
|
||||||
|
BOOL builtIn = NO;
|
||||||
|
if (dict[@"Built-In"]) {
|
||||||
|
builtIn = [dict[@"Built-In"] boolValue];
|
||||||
|
} else if ([dict[@"non-removable"] isKindOfClass:[NSString class]]) {
|
||||||
|
builtIn = [dict[@"non-removable"] isEqualToString:@"yes"];
|
||||||
|
}
|
||||||
|
|
||||||
|
MMPeripheralDevice *dev = [[MMPeripheralDevice alloc] init];
|
||||||
|
dev.name = name;
|
||||||
|
dev.busType = MMPeripheralBusTypeUSB;
|
||||||
|
dev.vendorName = vendor;
|
||||||
|
dev.vendorID = vendorID;
|
||||||
|
dev.productID = productID;
|
||||||
|
dev.serialNumber = serial;
|
||||||
|
dev.locationID = locID;
|
||||||
|
dev.isBuiltIn = builtIn;
|
||||||
|
|
||||||
|
[devices addObject:dev];
|
||||||
|
CFRelease(props);
|
||||||
|
}
|
||||||
|
IOObjectRelease(service);
|
||||||
|
}
|
||||||
|
IOObjectRelease(iterator);
|
||||||
|
}
|
||||||
|
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSArray<MMPeripheralDevice *> *)sampleThunderboltDevices {
|
||||||
|
NSMutableArray<MMPeripheralDevice *> *devices = [NSMutableArray array];
|
||||||
|
|
||||||
|
CFMutableDictionaryRef matching = IOServiceMatching("IOThunderboltDevice");
|
||||||
|
if (!matching) return devices;
|
||||||
|
|
||||||
|
io_iterator_t iterator = IO_OBJECT_NULL;
|
||||||
|
kern_return_t kr = IOServiceGetMatchingServices(kIOMainPortDefault, matching, &iterator);
|
||||||
|
if (kr != KERN_SUCCESS || iterator == IO_OBJECT_NULL) return devices;
|
||||||
|
|
||||||
|
io_service_t service = IO_OBJECT_NULL;
|
||||||
|
while ((service = IOIteratorNext(iterator)) != IO_OBJECT_NULL) {
|
||||||
|
CFMutableDictionaryRef props = NULL;
|
||||||
|
if (IORegistryEntryCreateCFProperties(service, &props, kCFAllocatorDefault, 0) == KERN_SUCCESS && props) {
|
||||||
|
NSDictionary *dict = (__bridge NSDictionary *)props;
|
||||||
|
|
||||||
|
NSString *name = dict[@"Device Name"] ?: dict[@"IOName"];
|
||||||
|
if (!name) name = @"Thunderbolt Device";
|
||||||
|
|
||||||
|
NSString *vendor = dict[@"Vendor Name"] ?: @"";
|
||||||
|
uint32_t vendorID = [dict[@"Vendor ID"] unsignedIntValue];
|
||||||
|
uint32_t productID = [dict[@"Device ID"] unsignedIntValue];
|
||||||
|
|
||||||
|
MMPeripheralDevice *dev = [[MMPeripheralDevice alloc] init];
|
||||||
|
dev.name = name;
|
||||||
|
dev.busType = MMPeripheralBusTypeThunderbolt;
|
||||||
|
dev.vendorName = vendor;
|
||||||
|
dev.vendorID = vendorID;
|
||||||
|
dev.productID = productID;
|
||||||
|
dev.isBuiltIn = NO;
|
||||||
|
|
||||||
|
[devices addObject:dev];
|
||||||
|
CFRelease(props);
|
||||||
|
}
|
||||||
|
IOObjectRelease(service);
|
||||||
|
}
|
||||||
|
IOObjectRelease(iterator);
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t ParseDataUInt32(NSData *data) {
|
||||||
|
if (![data isKindOfClass:[NSData class]] || data.length == 0) return 0;
|
||||||
|
uint32_t val = 0;
|
||||||
|
size_t copyLen = MIN(sizeof(val), data.length);
|
||||||
|
memcpy(&val, data.bytes, copyLen);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSArray<MMPeripheralDevice *> *)samplePCIDevices {
|
||||||
|
NSMutableArray<MMPeripheralDevice *> *devices = [NSMutableArray array];
|
||||||
|
|
||||||
|
CFMutableDictionaryRef matching = IOServiceMatching("IOPCIDevice");
|
||||||
|
if (!matching) return devices;
|
||||||
|
|
||||||
|
io_iterator_t iterator = IO_OBJECT_NULL;
|
||||||
|
kern_return_t kr = IOServiceGetMatchingServices(kIOMainPortDefault, matching, &iterator);
|
||||||
|
if (kr != KERN_SUCCESS || iterator == IO_OBJECT_NULL) return devices;
|
||||||
|
|
||||||
|
io_service_t service = IO_OBJECT_NULL;
|
||||||
|
while ((service = IOIteratorNext(iterator)) != IO_OBJECT_NULL) {
|
||||||
|
CFMutableDictionaryRef props = NULL;
|
||||||
|
if (IORegistryEntryCreateCFProperties(service, &props, kCFAllocatorDefault, 0) == KERN_SUCCESS && props) {
|
||||||
|
NSDictionary *dict = (__bridge NSDictionary *)props;
|
||||||
|
|
||||||
|
NSString *name = nil;
|
||||||
|
if ([dict[@"model"] isKindOfClass:[NSData class]]) {
|
||||||
|
name = [[NSString alloc] initWithData:dict[@"model"] encoding:NSUTF8StringEncoding];
|
||||||
|
name = [name stringByTrimmingCharactersInSet:[NSCharacterSet controlCharacterSet]];
|
||||||
|
}
|
||||||
|
if (!name || name.length == 0) {
|
||||||
|
name = dict[@"IOName"];
|
||||||
|
}
|
||||||
|
if (!name || name.length == 0) {
|
||||||
|
name = @"PCI Device";
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t vendorID = 0;
|
||||||
|
if ([dict[@"vendor-id"] isKindOfClass:[NSData class]]) {
|
||||||
|
vendorID = ParseDataUInt32(dict[@"vendor-id"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t deviceID = 0;
|
||||||
|
if ([dict[@"device-id"] isKindOfClass:[NSData class]]) {
|
||||||
|
deviceID = ParseDataUInt32(dict[@"device-id"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
MMPeripheralDevice *dev = [[MMPeripheralDevice alloc] init];
|
||||||
|
dev.name = name;
|
||||||
|
dev.busType = MMPeripheralBusTypePCI;
|
||||||
|
dev.vendorID = vendorID;
|
||||||
|
dev.productID = deviceID;
|
||||||
|
dev.isBuiltIn = YES;
|
||||||
|
|
||||||
|
[devices addObject:dev];
|
||||||
|
CFRelease(props);
|
||||||
|
}
|
||||||
|
IOObjectRelease(service);
|
||||||
|
}
|
||||||
|
IOObjectRelease(iterator);
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nullable NSDictionary<NSString *, id> *)sampleTelemetryWithError:(NSError **)error {
|
||||||
|
NSArray<MMPeripheralDevice *> *usb = [MMPeripheralsProvider sampleUSBDevices];
|
||||||
|
NSArray<MMPeripheralDevice *> *tb = [MMPeripheralsProvider sampleThunderboltDevices];
|
||||||
|
NSArray<MMPeripheralDevice *> *pci = [MMPeripheralsProvider samplePCIDevices];
|
||||||
|
|
||||||
|
NSMutableArray<NSDictionary<NSString *, id> *> *usbList = [NSMutableArray arrayWithCapacity:usb.count];
|
||||||
|
for (MMPeripheralDevice *d in usb) {
|
||||||
|
[usbList addObject:[d toDictionary]];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSMutableArray<NSDictionary<NSString *, id> *> *tbList = [NSMutableArray arrayWithCapacity:tb.count];
|
||||||
|
for (MMPeripheralDevice *d in tb) {
|
||||||
|
[tbList addObject:[d toDictionary]];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSMutableArray<NSDictionary<NSString *, id> *> *pciList = [NSMutableArray arrayWithCapacity:pci.count];
|
||||||
|
for (MMPeripheralDevice *d in pci) {
|
||||||
|
[pciList addObject:[d toDictionary]];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSUInteger totalCount = usb.count + tb.count + pci.count;
|
||||||
|
|
||||||
|
return @{
|
||||||
|
@"totalDeviceCount": @(totalCount),
|
||||||
|
@"usbDevices": usbList,
|
||||||
|
@"thunderboltDevices": tbList,
|
||||||
|
@"pciDevices": pciList
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
+654
-198
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
|||||||
|
//
|
||||||
|
// MMAudioTests.swift
|
||||||
|
// MacMonitorTests
|
||||||
|
//
|
||||||
|
// Unit and integration tests for MMAudioTelemetryProvider.
|
||||||
|
//
|
||||||
|
|
||||||
|
import XCTest
|
||||||
|
@testable import MacMonitor
|
||||||
|
|
||||||
|
final class MMAudioTests: XCTestCase {
|
||||||
|
var provider: MMAudioTelemetryProvider!
|
||||||
|
|
||||||
|
override func setUp() {
|
||||||
|
super.setUp()
|
||||||
|
provider = MMAudioTelemetryProvider()
|
||||||
|
}
|
||||||
|
|
||||||
|
override func tearDown() {
|
||||||
|
provider = nil
|
||||||
|
super.tearDown()
|
||||||
|
}
|
||||||
|
|
||||||
|
func testDomainAndIdentifier() {
|
||||||
|
XCTAssertEqual(provider.domain, .audio)
|
||||||
|
XCTAssertEqual(provider.providerIdentifier, "com.i3omb.macmonitor.telemetry.audio")
|
||||||
|
XCTAssertTrue(provider.isAvailable)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testSampleAudioDevicesLive() {
|
||||||
|
do {
|
||||||
|
let sample = try provider.sampleTelemetry()
|
||||||
|
XCTAssertNotNil(sample)
|
||||||
|
|
||||||
|
let count = sample["deviceCount"] as? Int ?? 0
|
||||||
|
XCTAssertGreaterThanOrEqual(count, 0)
|
||||||
|
|
||||||
|
let devices = sample["devices"] as? [[String: Any]] ?? []
|
||||||
|
XCTAssertEqual(devices.count, count)
|
||||||
|
|
||||||
|
if count > 0 {
|
||||||
|
for dev in devices {
|
||||||
|
XCTAssertNotNil(dev["name"])
|
||||||
|
XCTAssertNotNil(dev["deviceID"])
|
||||||
|
XCTAssertNotNil(dev["isInput"])
|
||||||
|
XCTAssertNotNil(dev["isOutput"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
XCTFail("sampleTelemetry threw error: \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testAudioDeviceModel() {
|
||||||
|
let dev = MMAudioDevice()
|
||||||
|
dev.deviceID = 42
|
||||||
|
dev.name = "External USB DAC"
|
||||||
|
dev.manufacturer = "FiiO"
|
||||||
|
dev.uid = "USB:1234"
|
||||||
|
dev.isInput = false
|
||||||
|
dev.isOutput = true
|
||||||
|
dev.isDefaultOutput = true
|
||||||
|
dev.isDefaultInput = false
|
||||||
|
dev.sampleRate = 96000.0
|
||||||
|
dev.channelCount = 2
|
||||||
|
dev.volume = 0.75
|
||||||
|
dev.isMuted = false
|
||||||
|
|
||||||
|
let dict = dev.toDictionary()
|
||||||
|
XCTAssertEqual(dict["deviceID"] as? UInt32, 42)
|
||||||
|
XCTAssertEqual(dict["name"] as? String, "External USB DAC")
|
||||||
|
XCTAssertEqual(dict["manufacturer"] as? String, "FiiO")
|
||||||
|
XCTAssertEqual(dict["isOutput"] as? Bool, true)
|
||||||
|
XCTAssertEqual(dict["isDefaultOutput"] as? Bool, true)
|
||||||
|
XCTAssertEqual(dict["sampleRate"] as? Double, 96000.0)
|
||||||
|
XCTAssertEqual(dict["channelCount"] as? UInt32, 2)
|
||||||
|
XCTAssertEqual(dict["volume"] as? Float, 0.75)
|
||||||
|
XCTAssertEqual(dict["isMuted"] as? Bool, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
//
|
||||||
|
// MMPeripheralsTests.swift
|
||||||
|
// MacMonitorTests
|
||||||
|
//
|
||||||
|
// Unit and integration tests for MMPeripheralsProvider.
|
||||||
|
//
|
||||||
|
|
||||||
|
import XCTest
|
||||||
|
@testable import MacMonitor
|
||||||
|
|
||||||
|
final class MMPeripheralsTests: XCTestCase {
|
||||||
|
var provider: MMPeripheralsProvider!
|
||||||
|
|
||||||
|
override func setUp() {
|
||||||
|
super.setUp()
|
||||||
|
provider = MMPeripheralsProvider()
|
||||||
|
}
|
||||||
|
|
||||||
|
override func tearDown() {
|
||||||
|
provider = nil
|
||||||
|
super.tearDown()
|
||||||
|
}
|
||||||
|
|
||||||
|
func testDomainAndIdentifier() {
|
||||||
|
XCTAssertEqual(provider.domain, .peripherals)
|
||||||
|
XCTAssertEqual(provider.providerIdentifier, "com.i3omb.macmonitor.telemetry.peripherals")
|
||||||
|
XCTAssertTrue(provider.isAvailable)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testSamplePeripheralsLive() {
|
||||||
|
do {
|
||||||
|
let sample = try provider.sampleTelemetry()
|
||||||
|
XCTAssertNotNil(sample)
|
||||||
|
|
||||||
|
let total = sample["totalDeviceCount"] as? Int ?? 0
|
||||||
|
XCTAssertGreaterThan(total, 0, "Host system should have at least 1 PCI/USB device")
|
||||||
|
|
||||||
|
let pci = sample["pciDevices"] as? [[String: Any]] ?? []
|
||||||
|
XCTAssertGreaterThan(pci.count, 0, "Intel Mac should have PCI devices (host bridge, GPU, etc.)")
|
||||||
|
|
||||||
|
if let firstPCI = pci.first {
|
||||||
|
XCTAssertNotNil(firstPCI["name"])
|
||||||
|
XCTAssertEqual(firstPCI["busType"] as? String, "PCI")
|
||||||
|
}
|
||||||
|
|
||||||
|
let usb = sample["usbDevices"] as? [[String: Any]] ?? []
|
||||||
|
for dev in usb {
|
||||||
|
XCTAssertEqual(dev["busType"] as? String, "USB")
|
||||||
|
XCTAssertNotNil(dev["name"])
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
XCTFail("sampleTelemetry threw error: \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testPeripheralDeviceModel() {
|
||||||
|
let dev = MMPeripheralDevice()
|
||||||
|
dev.name = "Magic Trackpad"
|
||||||
|
dev.busType = .USB
|
||||||
|
dev.vendorName = "Apple Inc."
|
||||||
|
dev.vendorID = 0x05ac
|
||||||
|
dev.productID = 0x0265
|
||||||
|
dev.isBuiltIn = false
|
||||||
|
|
||||||
|
let dict = dev.toDictionary()
|
||||||
|
XCTAssertEqual(dict["name"] as? String, "Magic Trackpad")
|
||||||
|
XCTAssertEqual(dict["busType"] as? String, "USB")
|
||||||
|
XCTAssertEqual(dict["vendorName"] as? String, "Apple Inc.")
|
||||||
|
XCTAssertEqual(dict["vendorID"] as? UInt32, 0x05ac)
|
||||||
|
XCTAssertEqual(dict["productID"] as? UInt32, 0x0265)
|
||||||
|
XCTAssertEqual(dict["isBuiltIn"] as? Bool, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,7 +28,7 @@ final class MacMonitorCoreTests: XCTestCase {
|
|||||||
func testSystemTelemetryStoreInitialStateAndProviders() {
|
func testSystemTelemetryStoreInitialStateAndProviders() {
|
||||||
let store = SystemTelemetryStore.shared
|
let store = SystemTelemetryStore.shared
|
||||||
XCTAssertNotNil(store)
|
XCTAssertNotNil(store)
|
||||||
XCTAssertEqual(store.registeredProviderCount, 7)
|
XCTAssertEqual(store.registeredProviderCount, 17)
|
||||||
XCTAssertFalse(store.hostModel.isEmpty)
|
XCTAssertFalse(store.hostModel.isEmpty)
|
||||||
XCTAssertFalse(store.kernelVersion.isEmpty)
|
XCTAssertFalse(store.kernelVersion.isEmpty)
|
||||||
XCTAssertGreaterThanOrEqual(store.physicalCpuCount, 1)
|
XCTAssertGreaterThanOrEqual(store.physicalCpuCount, 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user