All Projects → Wumpf → wgpu-profiler

Wumpf / wgpu-profiler

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
Simple profiler scopes for wgpu using timer queries

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to wgpu-profiler

wgpu-mc
Rust-based replacement for the default Minecraft renderer
Stars: ✭ 254 (+464.44%)
Mutual labels:  wgpu, wgpu-rs
nuance
A tool to run your shaders on the gpu. Also a good demo application for wgpu-rs.
Stars: ✭ 26 (-42.22%)
Mutual labels:  wgpu, wgpu-rs
Tracy
C++ frame profiler
Stars: ✭ 3,115 (+6822.22%)
Mutual labels:  profiler
Pyinstrument
🚴 Call stack profiler for Python. Shows you why your code is slow!
Stars: ✭ 3,870 (+8500%)
Mutual labels:  profiler
Coz
Coz: Causal Profiling
Stars: ✭ 2,719 (+5942.22%)
Mutual labels:  profiler
Unityheapexplorer
A Memory Profiler, Debugger and Analyzer for Unity 2019.3 and newer.
Stars: ✭ 179 (+297.78%)
Mutual labels:  profiler
Aprof
Java memory allocation profiler
Stars: ✭ 200 (+344.44%)
Mutual labels:  profiler
Phalcon Debugbar
A powerful debug and profilers tool for the Phalcon Framework
Stars: ✭ 159 (+253.33%)
Mutual labels:  profiler
profiler
Continuous profiling based on pprof
Stars: ✭ 221 (+391.11%)
Mutual labels:  profiler
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+4968.89%)
Mutual labels:  profiler
Router.cr
Minimum High Performance Middleware for Crystal Web Server.
Stars: ✭ 231 (+413.33%)
Mutual labels:  profiler
Spf4j
Simple performance framework for java
Stars: ✭ 184 (+308.89%)
Mutual labels:  profiler
Nlp profiler
A simple NLP library allows profiling datasets with one or more text columns. When given a dataset and a column name containing text data, NLP Profiler will return either high-level insights or low-level/granular statistical information about the text in that column.
Stars: ✭ 181 (+302.22%)
Mutual labels:  profiler
Liveprof
A performance monitoring system for running on live sites
Stars: ✭ 206 (+357.78%)
Mutual labels:  profiler
Yii2 Debug
Debug Extension for Yii 2
Stars: ✭ 179 (+297.78%)
Mutual labels:  profiler
Gecko-Profiler-Addon
(deprecated) Addon to control the Gecko Built-in Profiler
Stars: ✭ 20 (-55.56%)
Mutual labels:  profiler
Hotspot
The Linux perf GUI for performance analysis.
Stars: ✭ 2,415 (+5266.67%)
Mutual labels:  profiler
Loli profiler
Memory instrumentation tool for android app&game developers.
Stars: ✭ 179 (+297.78%)
Mutual labels:  profiler
Cloud Ops Sandbox
Cloud Operations Sandbox is an open source tool that helps practitioners to learn Service Reliability Engineering practices from Google and apply them on their cloud services using Cloud Operations suite of tools.
Stars: ✭ 191 (+324.44%)
Mutual labels:  profiler
IYFThreading
A C++11 thread pool and profiler
Stars: ✭ 24 (-46.67%)
Mutual labels:  profiler

wgpu-profiler

Crates.io

Simple profiler scopes for wgpu using timer queries

Features

  • Easy to use profiler scopes
    • Allows nesting!
    • Can be disabled by runtime flag
    • Additionally generates debug markers
  • Internally creates pools of timer queries automatically
    • Does not need to know in advance how many queries/profiling scopes are needed
    • Caches up profiler-frames until results are available
      • No stalling of the device at any time!
  • Many profiler instances can live side by side
  • chrome trace flamegraph json export

TODO:

  • Better error messages
  • Disable via feature flag

How to use

Create a new profiler object:

use wgpu_profiler::{wgpu_profiler, GpuProfiler};
// ...
let mut profiler = GpuProfiler::new(4, queue.get_timestamp_period(), device.features()); // buffer up to 4 frames

Using scopes is easiest with the macro:

wgpu_profiler!("name of your scope", &mut profiler, &mut encoder, &device, {
  // wgpu commands go here
});

Note that GpuProfiler reads the device features - if your wgpu device doesn't have wgpu::Features::TIMESTAMP_QUERY enabled, it will automatically not attempt to emit any timer queries. Similarly, if wgpu::Features::WRITE_TIMESTAMP_INSIDE_PASSES is not present, no queries will be issued from inside passes.

Wgpu-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:

profiler.resolve_queries(&mut encoder);

And finally, to end a profiling frame, call end_frame. This does a few checks and will let you know of something is off!

profiler.end_frame().unwrap();

Retrieving the oldest available frame and writing it out to a chrome trace file.

if let Some(profiling_data) = profiler.process_finished_frame() {
    // You usually want to write to disk only under some condition, e.g. press of a key or button
    wgpu_profiler::chrometrace::write_chrometrace(std::path::Path::new("mytrace.json"), &profiling_data);
}

To get a look of it in action, check out the example project!

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.

Changelog

  • 0.11.0
    • Upgrade to wgpu 0.15
  • 0.10.0
    • Upgrade to wgpu 0.14 and switch to rust 2021 edition, by @Imberflur in #23
  • 0.9.1
    • Better docs #21
    • Fix crash on dropped frame #20, reported by @JCapucho in #19
    • Fix enable_pass_timer/enable_encoder_timer checking wrong features
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].