summaryrefslogtreecommitdiff
path: root/src/cli/run.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 12:07:53 -0300
committerGabriel Schneider <[email protected]>2026-11-10 12:09:56 -0300
commita10e1691dbe5b944812dc8761a450636bc247e3d (patch)
tree68b4ae8b519496dd35a94bb799f3fd564ec42569 /src/cli/run.zig
parent08d36ff6295a5f04e503ffe0aaa8a4e712af865f (diff)
downloadcomputeranim-a10e1691dbe5b944812dc8761a450636bc247e3d.tar.gz
computeranim-a10e1691dbe5b944812dc8761a450636bc247e3d.zip
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 <[email protected]>
Diffstat (limited to 'src/cli/run.zig')
-rw-r--r--src/cli/run.zig4
1 files changed, 4 insertions, 0 deletions
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) {