summaryrefslogtreecommitdiff
path: root/targets/emit.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 11:08:49 -0300
committerGabriel Schneider <[email protected]>2026-11-10 11:08:49 -0300
commit0b29354e1ddf6cf75ac4c426a00dd3435ace5069 (patch)
tree918e6f6810a9b8b5a8ed17e698085e92018333b9 /targets/emit.zig
downloadcomputeranim-0b29354e1ddf6cf75ac4c426a00dd3435ace5069.tar.gz
computeranim-0b29354e1ddf6cf75ac4c426a00dd3435ace5069.zip
ztrace: the event, the ring, the recording, a ptrace loop
One 64-byte Event for every backend; a shared-memory ring from target to tracer with stop/resume; a Recorder that folds events into xitdb moments (registers, memory in 64-byte chunks with known-byte masks, strings) and a Trace that reads any moment back; a minimal ptrace Process; ztrace record, run and dump. Per-area build files so the areas grow apart.
Diffstat (limited to 'targets/emit.zig')
-rw-r--r--targets/emit.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/targets/emit.zig b/targets/emit.zig
new file mode 100644
index 0000000..e1b0b72
--- /dev/null
+++ b/targets/emit.zig
@@ -0,0 +1,14 @@
+//! A target that carries its own producer: emits N marks through the ring
+//! (argv[1], default 1000) and one write, then exits 7. The host test and
+//! the ring's throughput number run on it.
+const std = @import("std");
+const zt = @import("ztrace");
+
+pub fn main(init: std.process.Init.Minimal) u8 {
+ var args = init.args.iterate();
+ _ = args.skip();
+ const n = if (args.next()) |arg| std.fmt.parseInt(u64, arg, 10) catch 1000 else 1000;
+ zt.client.emit(.mem_write, 0, .{ 0x1000, 5, 0, 0, 0, 0 }, "hello");
+ for (0..n) |i| zt.client.emit(.mark, 0, .{ i, 0, 0, 0, 0, 0 }, "");
+ return 7;
+}