Coder Social home page Coder Social logo

rohankumardubey / puffin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from embarkstudios/puffin

0.0 0.0 0.0 8.4 MB

๐Ÿฆ Friendly little instrumentation profiler for Rust ๐Ÿฆ€

License: Apache License 2.0

Shell 0.40% Rust 99.60%

puffin's Introduction

๐Ÿฆ puffin

The friendly little instrumentation profiler for Rust

Puffin photo by Richard Bartz

(puffin photo by Richard Bartz)

Embark Embark Crates.io Docs dependency status Build Status

How to use

fn my_function() {
    puffin::profile_function!();
    ...
    if ... {
        puffin::profile_scope!("load_image", image_name);
        ...
    }
}

The Puffin macros write data to a thread-local data stream. When the outermost scope of a thread is closed, the data stream is sent to a global profiler collector. The scopes are pretty light-weight, costing around 100-200 nanoseconds.

You have to turn on the profiler before it captures any data with a call to puffin::set_scopes_on(true);. When the profiler is off the profiler scope macros only has an overhead of 1-2 ns (and some stack space);

Once per frame you need to call puffin::GlobalProfiler::lock().new_frame();.

UI

To view the profile data in-game you can use puffin_egui.

Puffin Flamegraph using puffin_egui

Remote profiling

You can use puffin_http to send profile events over TCP to puffin_viewer.

Other

Also check out the crate profiling which provides a unifying layer of abstraction on top of puffin and other profiling crates.

Contributing

Contributor Covenant

We welcome community contributions to this project.

Please read our Contributor Guide for more information on how to get started.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

puffin's People

Contributors

0xflotus avatar aclysma avatar bnjbvr avatar cad97 avatar deanbdean avatar emilk avatar gwen-lg avatar hrydgard avatar jake-shadle avatar janriemer avatar jms55 avatar jnises avatar joe1994 avatar lpil avatar marijns95 avatar maxded avatar nekrolm avatar renski-dev avatar repi avatar sidit77 avatar soniasingla avatar tgolsson avatar timonpost avatar tosti007 avatar vzout avatar xampprocky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.