{"id":15038107,"url":"https://github.com/embarkstudios/puffin","last_synced_at":"2025-05-14T05:10:28.136Z","repository":{"id":37097745,"uuid":"286426536","full_name":"EmbarkStudios/puffin","owner":"EmbarkStudios","description":"🐦 Friendly little instrumentation profiler for Rust 🦀","archived":false,"fork":false,"pushed_at":"2024-08-21T09:38:15.000Z","size":8766,"stargazers_count":1561,"open_issues_count":31,"forks_count":85,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-07T10:16:57.466Z","etag":null,"topics":["flamegraph","hacktoberfest","profiler","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EmbarkStudios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-10T09:03:31.000Z","updated_at":"2025-05-05T01:13:12.000Z","dependencies_parsed_at":"2023-11-19T20:30:03.744Z","dependency_job_id":"33291fa8-3da9-4cee-9260-32fd7e1fabb6","html_url":"https://github.com/EmbarkStudios/puffin","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":"EmbarkStudios/opensource-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpuffin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpuffin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpuffin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpuffin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EmbarkStudios","download_url":"https://codeload.github.com/EmbarkStudios/puffin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flamegraph","hacktoberfest","profiler","rust"],"created_at":"2024-09-24T20:37:08.147Z","updated_at":"2025-05-14T05:10:28.104Z","avatar_url":"https://github.com/EmbarkStudios.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n\n# `🐦 puffin`\n\n**The friendly little instrumentation profiler for Rust**\n\n![Puffin photo by Richard Bartz](puffin.jpg)\n\n[(puffin photo by Richard Bartz)](https://en.wikipedia.org/wiki/File:Papageitaucher_Fratercula_arctica.jpg)\n\n[![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](https://embark.dev)\n[![Embark](https://img.shields.io/badge/discord-ark-%237289da.svg?logo=discord)](https://discord.gg/dAuKfZS)\n[![Crates.io](https://img.shields.io/crates/v/puffin.svg)](https://crates.io/crates/puffin)\n[![Docs](https://docs.rs/puffin/badge.svg)](https://docs.rs/puffin)\n[![dependency status](https://deps.rs/repo/github/EmbarkStudios/puffin/status.svg)](https://deps.rs/repo/github/EmbarkStudios/puffin)\n[![Build Status](https://github.com/EmbarkStudios/puffin/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/puffin/actions?workflow=CI)\n\n\u003c/div\u003e\n\n## How to use\n\n``` rust\nfn my_function() {\n    puffin::profile_function!();\n    ...\n    if ... {\n        puffin::profile_scope!(\"load_image\", image_name);\n        ...\n    }\n}\n```\n\nThe 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 50-200 ns.\n\nYou 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 ns on an M1 MacBook Pro (plus some stack space).\n\nOnce per frame you need to call `puffin::GlobalProfiler::lock().new_frame();`.\n\n![Puffin Flamegraph using puffin_egui](puffin_egui.gif)\n\n## Remote profiling\n\nYou can use [`puffin_http`](https://github.com/EmbarkStudios/puffin/tree/main/puffin_http) to send profile events over TCP to [`puffin_viewer`](https://github.com/EmbarkStudios/puffin/tree/main/puffin_viewer). This is as easy as:\n\n```rs\nfn main() {\n    let server_addr = format!(\"127.0.0.1:{}\", puffin_http::DEFAULT_PORT);\n    let _puffin_server = puffin_http::Server::new(\u0026server_addr).unwrap();\n    eprintln!(\"Run this to view profiling data:  puffin_viewer {server_addr}\");\n    puffin::set_scopes_on(true);\n\n    …\n\n    // You also need to periodically call\n    // `puffin::GlobalProfiler::lock().new_frame();`\n    // to flush the profiling events.\n}\n```\n\n## [egui](https://github.com/emilk/egui) integration\n\nTo view the profile data in-game you can use [`puffin_egui`](https://github.com/EmbarkStudios/puffin/tree/main/puffin_egui).\n\nIf you are using [`eframe`](https://crates.io/crates/eframe) you can look at [this example](https://github.com/emilk/egui/tree/master/examples/puffin_profiler).\n\n## Other\n\nAlso check out the crate [`profiling`](https://crates.io/crates/profiling) which provides a unifying layer of abstraction on top of `puffin` and other profiling crates.\n\n## Contributing\n\n[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4-ff69b4.svg)](CODE_OF_CONDUCT.md)\n\nWe welcome community contributions to this project.\n\nPlease read our [Contributor Guide](CONTRIBUTING.md) for more information on how to get started.\n\n## Releasing\n\nWe use the [cargo release](https://github.com/crate-ci/cargo-release) tool to manage changelogs, git tags and publishing crates.\n\nEach substantial pull request should add a changelog entry under the `[Unreleased]` section (see [keep a changelog](https://keepachangelog.com)\nand previous changelog entries). The crate version in `Cargo.toml` is never updated manually in a PR as it's handled by `cargo release`.\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless 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.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembarkstudios%2Fpuffin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fembarkstudios%2Fpuffin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembarkstudios%2Fpuffin/lists"}