Zig library for generating spall-web profiling reports.
Tested with Zig version 0.12.0-dev.2043+6ebeb85ab
First add it as dependencie to your build.zig.zon
file:
.dependencies = .{
.spall = .{
.url = "https://git.sr.ht/~altagos/zig-spall/archive/{{COMMIT}}.tar.gz"
.hash = "{{HASH}}"
},
}
Replace {{COMMIT}}
with the latest commit, and {{HASH}}
will get generated during the next build (and displayed for you to copy and replace).
Then in build.zig
add it to your Compile step like this:
const spall = b.dependency("spall", .{
.target = target,
.optimize = optimize,
.enable = true, // Disabling spall will make any function call a nop (no operation), default: false
});
exe.addModule("spall", spall.module("spall"));
In your program:
const std = @import("std");
const spall = @import("spall");
pub fn main() !void {
try spall.init("./trace/example.spall");
defer spall.deinit();
while (true) {
try spall.init_thread();
defer spall.deinit_thread();
const span = spall.trace(@src(), "Hello World", .{});
std.debug.print("Hello World!\n");
span.end();
}
}
An example with threads is in the example folder.
-
zig-tracer: Generic tracing library for Zig, supports multiple backends.
zig-spall is based on zig-tracer's design.
-
zig-tracy: Easy to use bindings for the tracy client C API.
-
ztracy: performance markers for Tracy 0.10
part of michal-z/zig-gamedev
- add enable and disable options
- add compatibility with zig-tracer
- add documentation
- add test (?)
MIT, see LICENSE