Skip to content

lassade/profiler.zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A capable 200 lines profiler. It features a very simple API, supports multiple threads and dumps to a profile in the Trace Event Format

*Keep in mind profile.zig has hard limits like max_frames and max_threads, this is done to cap the memory usage, you can increase or decrese them as nescesary to your project.

const P = if (enable_profiling) @import("profiler.zig") else @import("profiler_mock.zig");

pub fn main() !void {
    P.init(.{});
    defer {
        P.dump("profile.json") catch |err| log.err("profile dump failed: {}", .{err});
        P.deinit();
    }

    const zone = P.begin(@src(), "main_fn");
    defer zone.end();

    // ... your code
}

About

A very simple profiler for zig

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages