{"id":15165105,"url":"https://github.com/Wumpf/wgpu-profiler","last_synced_at":"2025-09-30T20:31:42.444Z","repository":{"id":41441699,"uuid":"340989725","full_name":"Wumpf/wgpu-profiler","owner":"Wumpf","description":"Simple profiler scopes for wgpu using timer queries","archived":false,"fork":false,"pushed_at":"2024-09-21T13:32:25.000Z","size":203,"stargazers_count":92,"open_issues_count":9,"forks_count":24,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-14T02:46:40.964Z","etag":null,"topics":["gpu","profiler","wgpu","wgpu-rs"],"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/Wumpf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-21T19:50:35.000Z","updated_at":"2024-09-21T13:30:16.000Z","dependencies_parsed_at":"2023-10-16T11:06:51.552Z","dependency_job_id":"859166ff-e6bd-4238-82b3-c1f277628777","html_url":"https://github.com/Wumpf/wgpu-profiler","commit_stats":{"total_commits":59,"total_committers":8,"mean_commits":7.375,"dds":0.288135593220339,"last_synced_commit":"a1db696076d01eabc15ff17bfb319ef88f5b628c"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wumpf%2Fwgpu-profiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wumpf%2Fwgpu-profiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wumpf%2Fwgpu-profiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wumpf%2Fwgpu-profiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wumpf","download_url":"https://codeload.github.com/Wumpf/wgpu-profiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234630655,"owners_count":18863200,"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":["gpu","profiler","wgpu","wgpu-rs"],"created_at":"2024-09-27T04:01:03.482Z","updated_at":"2025-09-30T20:31:42.435Z","avatar_url":"https://github.com/Wumpf.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# wgpu-profiler\n[![Crates.io](https://img.shields.io/crates/v/wgpu-profiler.svg)](https://crates.io/crates/wgpu-profiler)\n\nSimple profiler scopes for wgpu using timer queries\n\n## Features\n\n* Easy to use profiler scopes\n  * Allows nesting!\n  * Can be disabled by runtime flag\n  * Additionally generates debug markers\n  * Thread-safe - can profile several command encoder/buffers in parallel\n* Internally creates pools of timer queries automatically\n  * Does not need to know in advance how many queries/profiling scopes are needed\n  * Caches up profiler-frames until results are available\n    * No stalling of the device at any time!\n* Many profiler instances can live side by side\n* chrome trace flamegraph json export\n* Tracy integration (behind `tracy` feature flag)\n* Puffin integration (behind `puffin` feature flag)\n\n## How to use\n\nCreate a new profiler object:\n```rust\nuse wgpu_profiler::{wgpu_profiler, GpuProfiler, GpuProfilerSettings};\n// ...\nlet mut profiler = GpuProfiler::new(\u0026device, GpuProfilerSettings::default());\n```\n\nNow you can start creating profiler scopes:\n```rust\n// You can now open profiling scopes on any encoder or pass:\nlet mut scope = profiler.scope(\"name of your scope\", \u0026mut encoder);\n\n// Scopes can be nested arbitrarily!\nlet mut nested_scope = scope.scope(\"nested!\");\n\n// Scopes on encoders can be used to easily create profiled passes!\nlet mut compute_pass = nested_scope.scoped_compute_pass(\"profiled compute\");\n\n// Scopes expose the underlying encoder or pass they wrap:\ncompute_pass.set_pipeline(\u0026pipeline);\n// ...\n\n// Scopes created this way are automatically closed when dropped.\n```\n\n`GpuProfiler` reads the device features on first use:\n\n* `wgpu::Features::TIMESTAMP_QUERY` is required to emit any timer queries.\n  * Alone, this allows you to use timestamp writes on pass definition as done by `Scope::scoped_compute_pass`/`Scope::scoped_render_pass`\n* `wgpu::Features::TIMESTAMP_QUERY_INSIDE_ENCODERS` is required to issue queries at any point within encoders.\n* `wgpu::Features::TIMESTAMP_QUERY_INSIDE_PASSES` is required to issue queries at any point within passes.\n\nWgpu-profiler needs to insert buffer copy commands, so when you're done with an encoder and won't do any more profiling scopes on it, you need to resolve the queries:\n```rust\nprofiler.resolve_queries(\u0026mut encoder);\n```\n\nAnd finally, to end a profiling frame, call `end_frame`. This does a few checks and will let you know if something is off!\n```rust\nprofiler.end_frame().unwrap();\n```\n\nRetrieving the oldest available frame and writing it out to a chrome trace file.\n```rust\nif let Some(profiling_data) = profiler.process_finished_frame(queue.get_timestamp_period()) {\n    wgpu_profiler::chrometrace::write_chrometrace(std::path::Path::new(\"mytrace.json\"), \u0026profiling_data);\n}\n```\n\n\nTo get a look of it in action, check out the [example](./examples/demo.rs)  project!\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWumpf%2Fwgpu-profiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWumpf%2Fwgpu-profiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWumpf%2Fwgpu-profiler/lists"}