From 8d91ecf978b99a79e3ff237cda14daa3d666509f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 11:19:14 -0300 Subject: recorder: moments in batches, and the heap, the stack, variables, lines and mappings in each MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A transaction a moment cost 10 µs and 1 KB before the moment's own data: the list's path copied each time. Moments now gather 256 to a transaction, each frozen by its own cursor so the list grows in place, and a thread's fields sit in the moment's map instead of two maps down: a small moment is 284 bytes and 1 µs, an instruction step with registers 780 bytes. A moment also folds alloc/free into the live heap, call/ret into each thread's stack, variable into the live variables (a local leaves with its call), line, and map/unmap, so a viewer reads any of them at any moment without replaying. --- src/trace/event.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/trace/event.zig') diff --git a/src/trace/event.zig b/src/trace/event.zig index 91e8c62..c24d7ac 100644 --- a/src/trace/event.zig +++ b/src/trace/event.zig @@ -28,7 +28,8 @@ pub const Kind = enum(u16) { mem_write = 16, /// a0=addr a1=len a2=pc mem_read = 17, - /// a0=ptr a1=size a2=caller pc. aux: `Alloc`. + /// a0=ptr a1=size a2=caller pc. aux: `Alloc`. A realloc that moves is a + /// `free` of the old pointer, then this. alloc = 18, /// a0=ptr a1=caller pc free = 19, @@ -79,6 +80,7 @@ pub const Alloc = enum(u16) { malloc, calloc, realloc, memalign, mmap }; pub const Event = extern struct { /// CLOCK_MONOTONIC nanoseconds. ts: u64 = 0, + /// 0 for an event no thread made (a string defined at startup). tid: u32 = 0, kind: Kind, /// Small kind-specific value (syscall number, signal, operand size). -- cgit v1.3