diff options
Diffstat (limited to 'anim/build.zig')
| -rw-r--r-- | anim/build.zig | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/anim/build.zig b/anim/build.zig index 29a4b05..21abbce 100644 --- a/anim/build.zig +++ b/anim/build.zig @@ -74,6 +74,12 @@ pub fn build(b: *std.Build) void { alloc: bool = false, /// A file of tools/ it reads, by its bare name. reads: ?[]const u8 = null, + /// Bytes of stack above rsp each stop records. An instrumented + /// program's runtime reads the clock through the vDSO, whose retry + /// loop is stepped: with 512 or more the loop seldom gets through + /// (`list` took 27 000 to 42 000 moments at 512, and 0.3 to 1.6 + /// million at 1024, against 3 900 at 256), so those take 256. + stack: []const u8 = "1024", }; for ([_]Recording{ .{ .name = "steps", .source = "fib.c", .by = "insn" }, @@ -83,8 +89,8 @@ pub fn build(b: *std.Build) void { // are told by the instrumentation (each a call into its runtime, // stepped like any other); `list` starts at `reverse`, its pushes // (the agent's and the runtime's first calls) run through. - .{ .name = "sort", .source = "sort.c", .by = "insn", .instr = "vars", .only = "sort,a", .from = "main" }, - .{ .name = "list", .source = "list.c", .by = "insn", .instr = "vars", .only = "push,reverse,head", .from = "reverse", .alloc = true }, + .{ .name = "sort", .source = "sort.c", .by = "insn", .instr = "vars", .only = "sort,a", .from = "main", .stack = "256" }, + .{ .name = "list", .source = "list.c", .by = "insn", .instr = "vars", .only = "push,reverse,head", .from = "reverse", .alloc = true, .stack = "256" }, }) |r| { const source = b.path(b.fmt("tools/{s}", .{r.source})); var program: std.Build.LazyPath = undefined; @@ -115,7 +121,11 @@ pub fn build(b: *std.Build) void { if (r.reads) |name| _ = where.addCopyFile(b.path(b.fmt("tools/{s}", .{name})), name); const run = b.addSystemCommand(&.{ "env", "-i", "setarch", "-R" }); run.addArtifactArg(ztrace); - run.addArgs(&.{ "record", "--by", r.by, "--stack", "256", "-s", "64" }); + // More round each stop than the working frame shows: the map of + // the whole context wants the words of the stack, 256 bytes round + // what a pointer leads to and what a step touches, and 69 + // instructions round the pc. + run.addArgs(&.{ "record", "--by", r.by, "--stack", r.stack, "--around", "256", "--disasm", "69", "-s", "64" }); if (r.from) |place| run.addArgs(&.{ "--from", place }); // What an instrumented program tells of itself comes through a ring. if (r.instr != null) run.addArg("--ring"); @@ -167,7 +177,7 @@ pub fn build(b: *std.Build) void { \\trap 'rm -rf "$d"' EXIT \\cp "$program" "$d/sqlite" \\cd "$d" - \\env -i setarch -R "$ztrace" record --by break -b sqlite3_step -b sqlite3BtreeInsert -b unixWrite -b "*$back" --stack 512 -s 4096 -o "$out" -- ./sqlite + \\env -i setarch -R "$ztrace" record --by break -b sqlite3_step -b sqlite3BtreeInsert -b unixWrite -b "*$back" --stack 1024 --around 256 --disasm 69 -s 4096 -o "$out" -- ./sqlite }); run.addArtifactArg(ztrace); run.addFileArg(program); |
