27 releases (breaking)

0.22.0 May 24, 2023
0.20.1 Jan 30, 2023
0.19.0 Dec 13, 2022
0.18.0 Nov 8, 2022
0.5.0 Nov 15, 2020

#925 in GUI


Used in ambient_profiling

MIT/Apache

155KB
3.5K SLoC

Puffin ImGui Flamegraph

Embark Embark Crates.io Docs

This crate provides a flamegraph view of the data collected by the Puffin profiler.

Example view

fn main() {
    puffin::set_scopes_on(true); // you may want to control this with a flag
    let mut puffin_ui = puffin_imgui::ProfilerUi::default();

    // game loop
    loop {
        puffin::GlobalProfiler::lock().new_frame();

        {
            puffin::profile_scope!("slow_code");
            slow_code();
        }

        puffin_ui.window(ui);
    }
}

lib.rs:

An imgui-rs interface for puffin.

Usage:

fn main() {
    puffin::set_scopes_on(true); // you may want to control this with a flag
    let mut puffin_ui = puffin_imgui::ProfilerUi::default();

    // game loop
    loop {
        puffin::GlobalProfiler::lock().new_frame();

        {
            puffin::profile_scope!("slow_code");
            slow_code();
        }

        puffin_ui.window(ui);
    }
}

Dependencies

~13–19MB
~274K SLoC