diff options
Diffstat (limited to 'src/trace/event.zig')
| -rw-r--r-- | src/trace/event.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/trace/event.zig b/src/trace/event.zig index 4a9f6f7..9ce8e94 100644 --- a/src/trace/event.zig +++ b/src/trace/event.zig @@ -159,6 +159,15 @@ pub const Regs = extern struct { } }; +/// The id of a string, for a producer that keeps no table: its text's +/// hash, with the top bit set. The instrumentation counts its strings from +/// 1, and a symbol's name is the string whose id is its address; a hash up +/// here meets neither, so the producers of one recording (a debugger, an +/// agent and instrumentation at once) never define an id twice. +pub fn stringId(text: []const u8) u64 { + return std.hash.Wyhash.hash(0, text) | 1 << 63; +} + pub fn now() u64 { var ts: std.os.linux.timespec = undefined; _ = std.os.linux.clock_gettime(.MONOTONIC, &ts); |
