From a10e1691dbe5b944812dc8761a450636bc247e3d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:07:53 -0300 Subject: agent: bench-agent and its numbers, hooks with names, an archive cc can link zig build bench-agent runs each capability against its native loop and prints what it costs and writes; README has the table. ztrace run looks at the ring a little longer before sleeping (a target that finds the tracer asleep pays a futex wake an event). A hooked function's name is defined as the string of its address, so the recorder's call stack reads fib. A static link without libc's malloc says which -u to add. The archive carries no stack probes, so cc links it in debug builds too. Tests for --wrap (musl, zig cc) and for a recording that fills. Co-Authored-By: Claude Fable 5.2 --- src/cli/run.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/cli') diff --git a/src/cli/run.zig b/src/cli/run.zig index db3529e..34455dd 100644 --- a/src/cli/run.zig +++ b/src/cli/run.zig @@ -129,6 +129,10 @@ pub fn run(init: std.process.Init, args: []const [:0]const u8) !void { // Everything pumped is recorded and read: whoever waits at it may go on. if (stops.held) session.ring.resumeAll(); stops.held = false; + // Look again for a while before sleeping: a target that finds the + // tracer asleep pays a futex wake for the event, more than the event. + var spins: usize = 0; + while (session.ring.peek() == null and spins < 2000) : (spins += 1) std.atomic.spinLoopHint(); } const ns = zt.event.now() - start; if (full) { -- cgit v1.3