summaryrefslogtreecommitdiff
path: root/src/trace/event.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 11:19:14 -0300
committerGabriel Schneider <[email protected]>2026-11-10 11:19:14 -0300
commit8d91ecf978b99a79e3ff237cda14daa3d666509f (patch)
treee0bd33a24916162f1cfa83d58760e0b4313ea3c7 /src/trace/event.zig
parent0b29354e1ddf6cf75ac4c426a00dd3435ace5069 (diff)
downloadcomputeranim-8d91ecf978b99a79e3ff237cda14daa3d666509f.tar.gz
computeranim-8d91ecf978b99a79e3ff237cda14daa3d666509f.zip
recorder: moments in batches, and the heap, the stack, variables, lines and mappings in each
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.
Diffstat (limited to 'src/trace/event.zig')
-rw-r--r--src/trace/event.zig4
1 files changed, 3 insertions, 1 deletions
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).