Closed aclysma closed 2 years ago
Also as a side note wgpu has a trace API: https://github.com/gfx-rs/wgpu/wiki/Debugging-wgpu-Applications#tracing-infrastructure
It might be possible to use that as a way of handling rendering issues that people may encounter.
The tracing
crate seems to be gaining some friction for general logging-type use. It could be useful. I'm not sure that it helps us in the case of tracing 3rd party code, though, unless we get the 3rd party to opt-in to tracing
as well.
As a plus, tracing is really easy to migrate to from log
and is specifically designed so that you can mostly just drop it in and have all of the logging macros work still.
This one looks interesting: https://github.com/EmbarkStudios/puffin
Bevy ECS does already have a simple integrated profiler that we use for system profiling: https://github.com/bevyengine/bevy/blob/master/crates/bevy_ecs/src/system/profiler.rs
If puffin is more featureful (and also provides us a way to pipe data into Bevy's diagnostics system), then we could consider swapping out for that.
Closing, as we've now integrated tracing
.
There are some nice profilers like https://optick.dev that can give very detailed and accurate captures for performance. Providing a way to add this instrumentation within the engine would be helpful when using these tools. The main kind of instrumentation would be capturing accurate timing from hot or suspected-to-be-hot functions.
One issue is that we aren't going to own every piece of code we rely on from top to bottom. For example, if we had an nphysics integration, and we wanted to instrument a hot function in nphysics, that might be tricky to do. Potentially we could come up with a design similar to the log crate that allowed upstream crates to be instrumented in a way that bevy can consume.
It's likely the interface for instrumenting the code can be agnostic to whatever profiler we might want to support.
An additional integration we could consider is renderdoc. I think the main value is that it helps it know when the start/end of a frame is.
Also from @StarArawn: