mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Compare commits
6 commits
b751e4a450
...
9e56be97c6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e56be97c6 | ||
|
|
edb1801152 | ||
|
|
fa0b57202c | ||
|
|
e2e64fd9c4 | ||
|
|
2ca48d323b | ||
|
|
e268840076 |
5 changed files with 172 additions and 10 deletions
|
|
@ -5,6 +5,7 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- master
|
||||
- max-rss-tuning
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
|
|
|
|||
123
build.zig
123
build.zig
|
|
@ -459,8 +459,29 @@ pub fn build(b: *std.Build) !void {
|
|||
.skip_linux = skip_linux,
|
||||
.skip_llvm = skip_llvm,
|
||||
.skip_libc = skip_libc,
|
||||
// 3888779264 was observed on an x86_64-linux-gnu host.
|
||||
.max_rss = 4000000000,
|
||||
.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,
|
||||
},
|
||||
}));
|
||||
|
||||
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
||||
|
|
@ -483,6 +504,29 @@ 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,
|
||||
},
|
||||
}));
|
||||
|
||||
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
||||
|
|
@ -505,6 +549,29 @@ 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,
|
||||
},
|
||||
}));
|
||||
|
||||
test_modules_step.dependOn(tests.addModuleTests(b, .{
|
||||
|
|
@ -526,8 +593,29 @@ pub fn build(b: *std.Build) !void {
|
|||
.skip_linux = skip_linux,
|
||||
.skip_llvm = skip_llvm,
|
||||
.skip_libc = skip_libc,
|
||||
// I observed a value of 5605064704 on the M2 CI.
|
||||
.max_rss = 6165571174,
|
||||
.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,
|
||||
},
|
||||
}));
|
||||
|
||||
const unit_tests_step = b.step("test-unit", "Run the compiler source unit tests");
|
||||
|
|
@ -543,6 +631,7 @@ 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;
|
||||
|
|
@ -721,7 +810,29 @@ 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 = 7_800_000_000,
|
||||
.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,
|
||||
},
|
||||
.root_module = addCompilerMod(b, options),
|
||||
});
|
||||
exe.stack_size = stack_size;
|
||||
|
|
@ -798,7 +909,7 @@ fn addCmakeCfgOptionsToExe(
|
|||
};
|
||||
mod.linkSystemLibrary("unwind", .{});
|
||||
},
|
||||
.ios, .macos, .watchos, .tvos, .visionos => {
|
||||
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => {
|
||||
mod.link_libcpp = true;
|
||||
},
|
||||
.windows => {
|
||||
|
|
|
|||
|
|
@ -4471,7 +4471,7 @@ pub const rusage = switch (native_os) {
|
|||
pub const SELF = 1;
|
||||
pub const CHILDREN = 2;
|
||||
},
|
||||
.freebsd => extern struct {
|
||||
.freebsd, .openbsd => extern struct {
|
||||
utime: timeval,
|
||||
stime: timeval,
|
||||
maxrss: c_long,
|
||||
|
|
@ -4493,6 +4493,27 @@ 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,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ pub const ResourceUsageStatistics = struct {
|
|||
/// if available.
|
||||
pub inline fn getMaxRss(rus: ResourceUsageStatistics) ?usize {
|
||||
switch (native_os) {
|
||||
.linux => {
|
||||
.dragonfly, .freebsd, .netbsd, .openbsd, .illumos, .linux, .serenity => {
|
||||
if (rus.rusage) |ru| {
|
||||
return @as(usize, @intCast(ru.maxrss)) * 1024;
|
||||
} else {
|
||||
|
|
@ -149,7 +149,21 @@ pub const ResourceUsageStatistics = struct {
|
|||
}
|
||||
|
||||
const rusage_init = switch (native_os) {
|
||||
.linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => @as(?posix.rusage, null),
|
||||
.dragonfly,
|
||||
.freebsd,
|
||||
.netbsd,
|
||||
.openbsd,
|
||||
.illumos,
|
||||
.linux,
|
||||
.serenity,
|
||||
.driverkit,
|
||||
.ios,
|
||||
.maccatalyst,
|
||||
.macos,
|
||||
.tvos,
|
||||
.visionos,
|
||||
.watchos,
|
||||
=> @as(?posix.rusage, null),
|
||||
.windows => @as(?windows.VM_COUNTERS, null),
|
||||
else => {},
|
||||
};
|
||||
|
|
@ -486,7 +500,21 @@ fn waitUnwrappedPosix(self: *ChildProcess) void {
|
|||
const res: posix.WaitPidResult = res: {
|
||||
if (self.request_resource_usage_statistics) {
|
||||
switch (native_os) {
|
||||
.linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => {
|
||||
.dragonfly,
|
||||
.freebsd,
|
||||
.netbsd,
|
||||
.openbsd,
|
||||
.illumos,
|
||||
.linux,
|
||||
.serenity,
|
||||
.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;
|
||||
|
|
|
|||
|
|
@ -2595,6 +2595,7 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue