feature. See also
. The project being documented here (as the example) is the Zig library itself.
Child.ResourceUsageStatistics
pub const ResourceUsageStatistics = struct
File
Code
pub const ResourceUsageStatistics = struct {
rusage: @TypeOf(rusage_init) = rusage_init,
pub inline fn getMaxRss(rus: ResourceUsageStatistics) ?usize {
switch (native_os) {
.dragonfly, .freebsd, .netbsd, .openbsd, .illumos, .linux, .serenity => {
if (rus.rusage) |ru| {
return @as(usize, @intCast(ru.maxrss)) * 1024;
} else {
return null;
}
},
.windows => {
if (rus.rusage) |ru| {
return ru.PeakWorkingSetSize;
} else {
return null;
}
},
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => {
if (rus.rusage) |ru| {
return @as(usize, @intCast(ru.maxrss));
} else {
return null;
}
},
else => return null,
}
}
const rusage_init = switch (native_os) {
.dragonfly,
.freebsd,
.netbsd,
.openbsd,
.illumos,
.linux,
.serenity,
.driverkit,
.ios,
.maccatalyst,
.macos,
.tvos,
.visionos,
.watchos,
=> @as(?std.posix.rusage, null),
.windows => @as(?std.os.windows.PROCESS.VM_COUNTERS, null),
else => {},
};
}