Files
MacMonitor/Sources/Telemetry/Network/MMNetworkBandwidthProvider.h
gronodandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> 4a8fd0e5ef fix(telemetry): realign snapshot contract — provider IDs and dictionary field keys (fixes #30, fixes #31)
Providers emitted identifiers and field keys that decodeSnapshot never
looked up, leaving CPU/kernel/load/disk sections zeroed and memory%,
storage%, network, process RSS, and fan fields decoded as zero.

Store-side decode now reads the emitted schema; providers gain the
previously-missing fields: network isUp (IFF_UP via getifaddrs), process
isStopped/isZombie (pbi_status), fan name (F{i}ID). Memory utilization is
computed as used/total in the decoder. decodeSnapshot is internal for
@testable access; new MMSnapshotContractTests cover the emitted-key
contract with synthetic dictionaries (93 tests total, 0 failures).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 15:09:19 +01:00

32 lines
1.3 KiB
Objective-C

#ifndef MMNetworkBandwidthProvider_h
#define MMNetworkBandwidthProvider_h
#import <Foundation/Foundation.h>
#import "MMTelemetryProvider.h"
NS_ASSUME_NONNULL_BEGIN
/**
* MMNetworkBandwidthProvider
* Samples real-time network download and upload throughput, packets/sec, and error counts
* across physical (Wi-Fi, Ethernet) and virtual (VPN, bridge) network interfaces.
*/
@interface MMNetworkBandwidthProvider : NSObject <MMTelemetryProvider>
- (instancetype)init;
/**
* Pure calculator method for deterministic unit testing.
*/
+ (NSDictionary<NSString *, id> *)calculateBandwidthMetricsWithCurrentSnapshots:(NSDictionary<NSString *, NSDictionary<NSString *, NSNumber *> *> *)current
previousSnapshots:(nullable NSDictionary<NSString *, NSDictionary<NSString *, NSNumber *> *> *)previous
timeDelta:(NSTimeInterval)timeDelta
ipAddresses:(nullable NSDictionary<NSString *, NSString *> *)ipAddresses
interfaceUpFlags:(nullable NSDictionary<NSString *, NSNumber *> *)interfaceUpFlags;
@end
NS_ASSUME_NONNULL_END
#endif /* MMNetworkBandwidthProvider_h */