33 lines
1.1 KiB
Objective-C
33 lines
1.1 KiB
Objective-C
#ifndef MMMemoryTelemetryProvider_h
|
|
#define MMMemoryTelemetryProvider_h
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <mach/mach.h>
|
|
#import <sys/sysctl.h>
|
|
#import "MMTelemetryProvider.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
/**
|
|
* MMMemoryTelemetryProvider
|
|
* Samples Mach virtual memory statistics, wired/active/inactive/compressed memory allocations,
|
|
* swap usage, and system-wide memory pressure levels.
|
|
*/
|
|
@interface MMMemoryTelemetryProvider : NSObject <MMTelemetryProvider>
|
|
|
|
@property (nonatomic, readonly) uint64_t totalPhysicalMemoryBytes;
|
|
|
|
/**
|
|
* Deterministic helper method for unit testing VM metric calculations.
|
|
*/
|
|
+ (NSDictionary<NSString *, id> *)calculateMemoryMetricsWithVMInfo:(const vm_statistics64_data_t *)vmInfo
|
|
pageSize:(vm_size_t)pageSize
|
|
totalPhysicalRAM:(uint64_t)totalRAM
|
|
swapUsage:(const struct xsw_usage * _Nullable)swap;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|
|
|
|
#endif /* MMMemoryTelemetryProvider_h */
|