summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 12:15:20 -0300
committerGabriel Schneider <[email protected]>2026-11-10 12:28:33 -0300
commit952af9711cc6a4de987a9d9d45e1e36721c5b470 (patch)
tree13da451d702416dd30a446c8265e8dddb8b8580e /build.zig
parent8008a2655c0f0c9b9890fb4866f774c9b50e170c (diff)
downloadcomputeranim-952af9711cc6a4de987a9d9d45e1e36721c5b470.tar.gz
computeranim-952af9711cc6a4de987a9d9d45e1e36721c5b470.zip
ztrace perf takes the target's own ring: allocations among the page faults
--preload and --alloc on ztrace perf: what the agent says and what the kernel sees are merged by time into one recording (perf.Sorted, as probe merges BPF and perf). test-together runs a list under both.
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig20
1 files changed, 19 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index e7dd08a..19fa712 100644
--- a/build.zig
+++ b/build.zig
@@ -109,6 +109,24 @@ pub fn build(b: *std.Build) void {
shown.addArg("show");
shown.addFileArg(recording);
inline for (.{ "6 breakpoint", "5 alloc", "7 call", "7 ret", " variable", " line" }) |part| shown.expectStdOutMatch(part);
- ctx.areaTest("test-together", "A debugger, the agent and instrumentation on one program").dependOn(&shown.step);
+ const both = ctx.areaTest("test-together", "The backends on one program, in one recording");
+ both.dependOn(&shown.step);
+
+ // ... and the kernel's view with the program's own: a list's
+ // allocations among the page faults of the heap they grow.
+ const seen = b.addRunArtifact(exe);
+ seen.addArgs(&.{ "perf", "--faults", "--alloc", "--preload" });
+ seen.addArtifactArg(agent);
+ seen.addArg("-o");
+ const kernel_and_own = seen.addOutputFileArg("perf-agent.ztrace");
+ seen.addArg("--");
+ seen.addArtifactArg(ctx.cTarget("agent_list", &.{"agent_list.c"}));
+ seen.addArg("100");
+ seen.expectStdErrMatch("(0 lost)");
+ const listed = b.addRunArtifact(exe);
+ listed.addArg("show");
+ listed.addFileArg(kernel_and_own);
+ inline for (.{ " alloc", " free", " fault", " map" }) |part| listed.expectStdOutMatch(part);
+ both.dependOn(&listed.step);
@import("build/kernel.zig").add(ctx);
}