authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-11-21 10:38:15 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-11-21 10:38:15 -08:00
loge5b21467c891fe9a2956358a38b496a5d9a174fc
tree8dd49e50cf8d028fa0757ea80bb6428171714cc8
parent0433545c0c204d76f746eca1ee143d1fe296b020

add a lot more info to README


1 files changed, 18 insertions(+), 1 deletions(-)

README.md+18-1
......@@ -16,7 +16,7 @@ const std = @import("std");
1616const tracer = @import("tracer");
1717pub const build_options = @import("build_options");
1818
19pub const tracer_impl = tracer.spall; // supports none, log, spall out of the box
19pub const tracer_impl = tracer.spall; // see 'Backends' section below
2020
2121pub fn main() !void {
2222 try tracer.init();
......@@ -43,6 +43,23 @@ fn handler() void {
4343exe_options.addOption(usize, "src_file_trimlen", std.fs.path.dirname(std.fs.path.dirname(@src().file).?).?.len);
4444```
4545
46## Backends
47
48- `none` this is the default and causes tracing calls to become a no-op so that `tracer` can be added to libraries transparently
49- `log` uses `std.log` to print on function entrance.
50- `chrome` writes a json file in the `chrome://tracing` format described [here](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview) and [here](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool/).
51- `spall` writes a binary file compatible with the [Spall](https://gravitymoth.com/spall/) profiler.
52- more? feel free to open an issue with requests!
53
54Any custom backend may also be used that defines the following functions:
55
56- `pub fn init() !void`
57- `pub fn deinit() void`
58- `pub fn init_thread() !void`
59- `pub fn deinit_thread() void`
60- `pub inline fn trace_begin(ctx: tracer.Ctx, comptime ifmt: []const u8, iargs: anytype) void`
61- `pub inline fn trace_end(ctx: tracer.Ctx) void`
62
4663## License
4764
4865MIT