Compare commits

..

1 commit

Author SHA1 Message Date
Alex Rønne Petersen
b751e4a450
set max_rss=1 everywhere to see what we actually get on all machines 2025-12-03 02:34:13 +01:00
4 changed files with 10 additions and 171 deletions

123
build.zig
View file

@ -459,29 +459,7 @@ pub fn build(b: *std.Build) !void {
.skip_linux = skip_linux,
.skip_llvm = skip_llvm,
.skip_libc = skip_libc,
.max_rss = switch (b.graph.host.result.os.tag) {
.freebsd => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 1, // TODO
else => 0,
},
.linux => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 659809075,
.loongarch64 => 598902374,
.riscv64 => 1, // TODO
.s390x => 580596121,
.x86_64 => 3290894745,
else => 0,
},
.macos => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 767736217,
else => 0,
},
.windows => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 603070054,
else => 0,
},
else => 0,
},
.max_rss = 1,
}));
test_modules_step.dependOn(tests.addModuleTests(b, .{
@ -504,29 +482,7 @@ pub fn build(b: *std.Build) !void {
.skip_llvm = skip_llvm,
.skip_libc = true,
.no_builtin = true,
.max_rss = switch (b.graph.host.result.os.tag) {
.freebsd => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 1, // TODO
else => 0,
},
.linux => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 639565414,
.loongarch64 => 598884352,
.riscv64 => 1, // TODO
.s390x => 574166630,
.x86_64 => 764861644,
else => 0,
},
.macos => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 701413785,
else => 0,
},
.windows => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 536414208,
else => 0,
},
else => 0,
},
.max_rss = 1,
}));
test_modules_step.dependOn(tests.addModuleTests(b, .{
@ -549,29 +505,7 @@ pub fn build(b: *std.Build) !void {
.skip_llvm = skip_llvm,
.skip_libc = true,
.no_builtin = true,
.max_rss = switch (b.graph.host.result.os.tag) {
.freebsd => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 1, // TODO
else => 0,
},
.linux => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 615302758,
.loongarch64 => 598974464,
.riscv64 => 1, // TODO
.s390x => 395555635,
.x86_64 => 528128409,
else => 0,
},
.macos => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 451389030,
else => 0,
},
.windows => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 317852057,
else => 0,
},
else => 0,
},
.max_rss = 1,
}));
test_modules_step.dependOn(tests.addModuleTests(b, .{
@ -593,29 +527,7 @@ pub fn build(b: *std.Build) !void {
.skip_linux = skip_linux,
.skip_llvm = skip_llvm,
.skip_libc = skip_libc,
.max_rss = switch (b.graph.host.result.os.tag) {
.freebsd => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 1, // TODO
else => 0,
},
.linux => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 6732817203,
.loongarch64 => 3216349593,
.riscv64 => 1, // TODO
.s390x => 3652514201,
.x86_64 => 5554053120,
else => 0,
},
.macos => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 8273795481,
else => 0,
},
.windows => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 3750236160,
else => 0,
},
else => 0,
},
.max_rss = 1,
}));
const unit_tests_step = b.step("test-unit", "Run the compiler source unit tests");
@ -631,7 +543,6 @@ pub fn build(b: *std.Build) !void {
.use_llvm = use_llvm,
.use_lld = use_llvm,
.zig_lib_dir = b.path("lib"),
.max_rss = 1,
});
if (link_libc) {
unit_tests.root_module.link_libc = true;
@ -810,29 +721,7 @@ fn addCompilerMod(b: *std.Build, options: AddCompilerModOptions) *std.Build.Modu
fn addCompilerStep(b: *std.Build, options: AddCompilerModOptions) *std.Build.Step.Compile {
const exe = b.addExecutable(.{
.name = "zig",
.max_rss = switch (b.graph.host.result.os.tag) {
.freebsd => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 1, // TODO
else => 0,
},
.linux => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 6240805683,
.loongarch64 => 5024158515,
.riscv64 => 1, // TODO
.s390x => 4997174476,
.x86_64 => 5486090649,
else => 0,
},
.macos => switch (b.graph.host.result.cpu.arch) {
.aarch64 => 6639145779,
else => 0,
},
.windows => switch (b.graph.host.result.cpu.arch) {
.x86_64 => 5770394009,
else => 0,
},
else => 0,
},
.max_rss = 1,
.root_module = addCompilerMod(b, options),
});
exe.stack_size = stack_size;
@ -909,7 +798,7 @@ fn addCmakeCfgOptionsToExe(
};
mod.linkSystemLibrary("unwind", .{});
},
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => {
.ios, .macos, .watchos, .tvos, .visionos => {
mod.link_libcpp = true;
},
.windows => {

View file

@ -4471,7 +4471,7 @@ pub const rusage = switch (native_os) {
pub const SELF = 1;
pub const CHILDREN = 2;
},
.freebsd, .openbsd => extern struct {
.freebsd => extern struct {
utime: timeval,
stime: timeval,
maxrss: c_long,
@ -4493,27 +4493,6 @@ pub const rusage = switch (native_os) {
pub const CHILDREN = -1;
pub const THREAD = 1;
},
.dragonfly, .netbsd => extern struct {
utime: timeval,
stime: timeval,
maxrss: c_long,
ixrss: c_long,
idrss: c_long,
isrss: c_long,
minflt: c_long,
majflt: c_long,
nswap: c_long,
inblock: c_long,
oublock: c_long,
msgsnd: c_long,
msgrcv: c_long,
nsignals: c_long,
nvcsw: c_long,
nivcsw: c_long,
pub const SELF = 0;
pub const CHILDREN = -1;
},
else => void,
};

View file

@ -122,7 +122,7 @@ pub const ResourceUsageStatistics = struct {
/// if available.
pub inline fn getMaxRss(rus: ResourceUsageStatistics) ?usize {
switch (native_os) {
.dragonfly, .freebsd, .netbsd, .openbsd, .illumos, .linux, .serenity => {
.linux => {
if (rus.rusage) |ru| {
return @as(usize, @intCast(ru.maxrss)) * 1024;
} else {
@ -149,21 +149,7 @@ pub const ResourceUsageStatistics = struct {
}
const rusage_init = switch (native_os) {
.dragonfly,
.freebsd,
.netbsd,
.openbsd,
.illumos,
.linux,
.serenity,
.driverkit,
.ios,
.maccatalyst,
.macos,
.tvos,
.visionos,
.watchos,
=> @as(?posix.rusage, null),
.linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => @as(?posix.rusage, null),
.windows => @as(?windows.VM_COUNTERS, null),
else => {},
};
@ -500,21 +486,7 @@ fn waitUnwrappedPosix(self: *ChildProcess) void {
const res: posix.WaitPidResult = res: {
if (self.request_resource_usage_statistics) {
switch (native_os) {
.dragonfly,
.freebsd,
.netbsd,
.openbsd,
.illumos,
.linux,
.serenity,
.driverkit,
.ios,
.maccatalyst,
.macos,
.tvos,
.visionos,
.watchos,
=> {
.linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => {
var ru: posix.rusage = undefined;
const res = posix.wait4(self.id, 0, &ru);
self.resource_usage_statistics.rusage = ru;

View file

@ -2595,7 +2595,6 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
.root_module = test_mod,
.use_llvm = c_abi_target.use_llvm,
.use_lld = c_abi_target.use_lld,
.max_rss = 1,
});
// This test is intentionally trying to check if the external ABI is