Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Enable wgpu profiling spans when using bevy's trace feature #5182

Closed
wants to merge 4 commits into from

Conversation

superdump
Copy link
Contributor

Objective

  • Enable wgpu profiling spans

Solution

  • wgpu uses the profiling crate to add profiling span instrumentation to their code
  • profiling offers multiple 'backends' for profiling, including tracing
  • When the bevy trace feature is used, add the profiling crate with its profile-with-tracing feature to enable appropriate profiling spans in wgpu using tracing which fits nicely into our infrastructure
  • Bump our default tracing subscriber filter to wgpu=info from wgpu=error so that the profiling spans are not filtered out as they are created at the info level.

Changelog

  • Added: tracing profiling support for wgpu when using bevy's trace feature
  • Changed: The default tracing filter statement for wgpu has been changed from the error level to the info level to not filter out the wgpu profiling spans

@superdump superdump added A-Rendering Drawing game state to the screen C-Usability A simple quality-of-life change that makes Bevy easier to use C-Enhancement A new feature C-Performance A change motivated by improving speed, memory usage or compile times C-Testing A change that impacts how we test Bevy or how users test their apps A-Diagnostics Logging, crash handling, error reporting and performance analysis A-Utils Utility functions and types labels Jul 3, 2022
@superdump superdump added this to the Bevy 0.8 milestone Jul 3, 2022
Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a separate feature from Bevy tracing.
People will often be interested in tracing to profile their system, not always to profile their GPU usage. Ideally we should be able to do both independently

@superdump
Copy link
Contributor Author

In that case I want to rename the wgpu_trace feature to wgpu_api_trace (because it enables a feature that traces the wgpu api calls for debug and replay purposes) and call this new feature for enabling profiling tracing trace_wgpu for consistency with our other trace_* features. Sound ok @mockersf ?

@mockersf
Copy link
Member

mockersf commented Jul 4, 2022

I was wondering - are spans enabled depending on the log level of the emitting crate? If that's the case, reusing the feature would be fine, it would just need more docs, something like: "if you want to see your system spans, set this log level, if you want wgpu spans, set this level, if you want both ..."

Otherwise, the feature renaming sounds good!

@superdump
Copy link
Contributor Author

I was wondering - are spans enabled depending on the log level of the emitting crate? If that's the case, reusing the feature would be fine, it would just need more docs, something like: "if you want to see your system spans, set this log level, if you want wgpu spans, set this level, if you want both ..."

Yes, spans are enabled based on the log level defined at the span creation site. The profiling::scope!() macro used in wgpu uses the tracing info level for its spans. So we could just tell people to override the default tracing subscriber filter with wgpu=info instead of me changing that. However, doing that using RUST_LOG could incur all the wgpu logs as well, and not just the tracing spans... goes to test it... I think it seems like using RUST_LOG=info captures all the bevy and wgpu spans.

So, I will roll back the changes to the default log filter, and instead add documentation about using RUST_LOG=info for profiling to capture the wgpu spans as well.

@superdump
Copy link
Contributor Author

@mockersf I have added documentation into Cargo.toml above the profiling crate. I do not think this is the best place, but there is a separate open PR for adding information about using Tracy for profiling to the markdown docs so I'll add something more as part of that now and get that finished. We're asking people who contribute to do benchmarking much more frequently these days.

@superdump
Copy link
Contributor Author

bors r+

bors bot pushed a commit that referenced this pull request Jul 4, 2022
# Objective

- Enable `wgpu` profiling spans

## Solution

- `wgpu` uses the `profiling` crate to add profiling span instrumentation to their code
- `profiling` offers multiple 'backends' for profiling, including `tracing`
- When the `bevy` `trace` feature is used, add the `profiling` crate with its `profile-with-tracing` feature to enable appropriate profiling spans in `wgpu` using `tracing` which fits nicely into our infrastructure
- Bump our default `tracing` subscriber filter to `wgpu=info` from `wgpu=error` so that the profiling spans are not filtered out as they are created at the `info` level.

---

## Changelog

- Added: `tracing` profiling support for `wgpu` when using bevy's `trace` feature
- Changed: The default `tracing` filter statement for `wgpu` has been changed from the `error` level to the `info` level to not filter out the wgpu profiling spans
@bors bors bot changed the title Enable wgpu profiling spans when using bevy's trace feature [Merged by Bors] - Enable wgpu profiling spans when using bevy's trace feature Jul 4, 2022
@bors bors bot closed this Jul 4, 2022
bors bot pushed a commit that referenced this pull request Jul 4, 2022
# Objective

- Document how to do profiling with Tracy

# Solution

- The documentation of setting `RUST_LOG=info` in order to capture `wgpu` spans depends on #5182
inodentry pushed a commit to IyesGames/bevy that referenced this pull request Aug 8, 2022
…ne#5182)

# Objective

- Enable `wgpu` profiling spans

## Solution

- `wgpu` uses the `profiling` crate to add profiling span instrumentation to their code
- `profiling` offers multiple 'backends' for profiling, including `tracing`
- When the `bevy` `trace` feature is used, add the `profiling` crate with its `profile-with-tracing` feature to enable appropriate profiling spans in `wgpu` using `tracing` which fits nicely into our infrastructure
- Bump our default `tracing` subscriber filter to `wgpu=info` from `wgpu=error` so that the profiling spans are not filtered out as they are created at the `info` level.

---

## Changelog

- Added: `tracing` profiling support for `wgpu` when using bevy's `trace` feature
- Changed: The default `tracing` filter statement for `wgpu` has been changed from the `error` level to the `info` level to not filter out the wgpu profiling spans
inodentry pushed a commit to IyesGames/bevy that referenced this pull request Aug 8, 2022
# Objective

- Document how to do profiling with Tracy

# Solution

- The documentation of setting `RUST_LOG=info` in order to capture `wgpu` spans depends on bevyengine#5182
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
…ne#5182)

# Objective

- Enable `wgpu` profiling spans

## Solution

- `wgpu` uses the `profiling` crate to add profiling span instrumentation to their code
- `profiling` offers multiple 'backends' for profiling, including `tracing`
- When the `bevy` `trace` feature is used, add the `profiling` crate with its `profile-with-tracing` feature to enable appropriate profiling spans in `wgpu` using `tracing` which fits nicely into our infrastructure
- Bump our default `tracing` subscriber filter to `wgpu=info` from `wgpu=error` so that the profiling spans are not filtered out as they are created at the `info` level.

---

## Changelog

- Added: `tracing` profiling support for `wgpu` when using bevy's `trace` feature
- Changed: The default `tracing` filter statement for `wgpu` has been changed from the `error` level to the `info` level to not filter out the wgpu profiling spans
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
# Objective

- Document how to do profiling with Tracy

# Solution

- The documentation of setting `RUST_LOG=info` in order to capture `wgpu` spans depends on bevyengine#5182
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…ne#5182)

# Objective

- Enable `wgpu` profiling spans

## Solution

- `wgpu` uses the `profiling` crate to add profiling span instrumentation to their code
- `profiling` offers multiple 'backends' for profiling, including `tracing`
- When the `bevy` `trace` feature is used, add the `profiling` crate with its `profile-with-tracing` feature to enable appropriate profiling spans in `wgpu` using `tracing` which fits nicely into our infrastructure
- Bump our default `tracing` subscriber filter to `wgpu=info` from `wgpu=error` so that the profiling spans are not filtered out as they are created at the `info` level.

---

## Changelog

- Added: `tracing` profiling support for `wgpu` when using bevy's `trace` feature
- Changed: The default `tracing` filter statement for `wgpu` has been changed from the `error` level to the `info` level to not filter out the wgpu profiling spans
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- Document how to do profiling with Tracy

# Solution

- The documentation of setting `RUST_LOG=info` in order to capture `wgpu` spans depends on bevyengine#5182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis A-Rendering Drawing game state to the screen A-Utils Utility functions and types C-Enhancement A new feature C-Performance A change motivated by improving speed, memory usage or compile times C-Testing A change that impacts how we test Bevy or how users test their apps C-Usability A simple quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants