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] - Add trace_tracy feature for Tracy profiling #2832

Closed
wants to merge 4 commits into from

Conversation

superdump
Copy link
Contributor

Objective

Tracy is:

A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

With the trace_tracy feature enabled, you run your bevy app and either a headless server (capture) or a live, interactive profiler UI (Tracy), and connect that to your bevy application to then stream the metric data and events, and save it or inspect it live/offline.

Previously when I implemented the spans across systems and stages and I was trying out different profiling tools, Tracy was too unstable on macOS to use. But now, quite some months later, it is working stably with Tracy 0.7.8. You can see timelines, aggregate statistics of mean system/stage execution times, and much more. It's very useful!

Screenshot_2021-09-15_at_18 07 19

Solution

  • Use the tracing-tracy crate which supports our tracing spans
  • Expose via the non-default feature trace_tracy for consistency with other trace* features

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Sep 16, 2021
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

Makes sense to me

It's unclear why tracing-tracy and tracing-chrome are mutually exclusive.

crates/bevy_log/src/lib.rs Outdated Show resolved Hide resolved
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.

@mockersf
Copy link
Member

also some sort of doc on tracing could be useful but can be done in another pr

@superdump
Copy link
Contributor Author

Could you also document the new feature in https://github.com/bevyengine/bevy/blob/main/docs/cargo_features.md

Done.

also some sort of doc on tracing could be useful but can be done in another pr

Once I have used it a bit more I will write something as a quick start guide, but Tracy has a pretty comprehensive pdf documentation that ships with each release, so I would probably defer to that.

crates/bevy_log/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

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

@superdump
Copy link
Contributor Author

If people are interested to see how I've been using this, you can check out the Visibility culling thread in #rendering-dev on Discord. Basically looking at mean system execution times to understand how much of an improvement frustum culling was producing, and in which systems. It's great for getting more of that sort of engineering feel for how the engine 'sounds'. :) It lead to me learning some stuff about how vsync seems to misbehave on macOS too.

@cart
Copy link
Member

cart commented Sep 16, 2021

Maybe consider updating https://github.com/bevyengine/bevy/blob/main/docs/profiling.md

This could use an overhaul in general. Imo we shouldn't recommend thread_profiler anymore when we have tracing and we should add a section for the various tracing backends.

@cart
Copy link
Member

cart commented Sep 16, 2021

Imo we should do that separately.

@cart
Copy link
Member

cart commented Sep 16, 2021

bors r+

bors bot pushed a commit that referenced this pull request Sep 16, 2021
# Objective

[Tracy](https://github.com/wolfpld/tracy) is:
> A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

With the `trace_tracy` feature enabled, you run your bevy app and either a headless server (`capture`) or a live, interactive profiler UI (`Tracy`), and connect that to your bevy application to then stream the metric data and events, and save it or inspect it live/offline.

Previously when I implemented the spans across systems and stages and I was trying out different profiling tools, Tracy was too unstable on macOS to use. But now, quite some months later, it is working stably with Tracy 0.7.8. You can see timelines, aggregate statistics of mean system/stage execution times, and much more. It's very useful!

![Screenshot_2021-09-15_at_18 07 19](https://user-images.githubusercontent.com/302146/133554920-350d3d45-fbb8-479f-91f7-7a7a4f9f5873.png)

## Solution

- Use the `tracing-tracy` crate which supports our tracing spans
- Expose via the non-default feature `trace_tracy` for consistency with other `trace*` features
@bors
Copy link
Contributor

bors bot commented Sep 16, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Sep 16, 2021
# Objective

[Tracy](https://github.com/wolfpld/tracy) is:
> A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

With the `trace_tracy` feature enabled, you run your bevy app and either a headless server (`capture`) or a live, interactive profiler UI (`Tracy`), and connect that to your bevy application to then stream the metric data and events, and save it or inspect it live/offline.

Previously when I implemented the spans across systems and stages and I was trying out different profiling tools, Tracy was too unstable on macOS to use. But now, quite some months later, it is working stably with Tracy 0.7.8. You can see timelines, aggregate statistics of mean system/stage execution times, and much more. It's very useful!

![Screenshot_2021-09-15_at_18 07 19](https://user-images.githubusercontent.com/302146/133554920-350d3d45-fbb8-479f-91f7-7a7a4f9f5873.png)

## Solution

- Use the `tracing-tracy` crate which supports our tracing spans
- Expose via the non-default feature `trace_tracy` for consistency with other `trace*` features
@bors bors bot changed the title Add trace_tracy feature for Tracy profiling [Merged by Bors] - Add trace_tracy feature for Tracy profiling Sep 17, 2021
@bors bors bot closed this Sep 17, 2021
superdump added a commit to superdump/bevy that referenced this pull request Sep 17, 2021
[Tracy](https://github.com/wolfpld/tracy) is:
> A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

With the `trace_tracy` feature enabled, you run your bevy app and either a headless server (`capture`) or a live, interactive profiler UI (`Tracy`), and connect that to your bevy application to then stream the metric data and events, and save it or inspect it live/offline.

Previously when I implemented the spans across systems and stages and I was trying out different profiling tools, Tracy was too unstable on macOS to use. But now, quite some months later, it is working stably with Tracy 0.7.8. You can see timelines, aggregate statistics of mean system/stage execution times, and much more. It's very useful!

![Screenshot_2021-09-15_at_18 07 19](https://user-images.githubusercontent.com/302146/133554920-350d3d45-fbb8-479f-91f7-7a7a4f9f5873.png)

- Use the `tracing-tracy` crate which supports our tracing spans
- Expose via the non-default feature `trace_tracy` for consistency with other `trace*` features
superdump added a commit to superdump/bevy that referenced this pull request Oct 3, 2021
[Tracy](https://github.com/wolfpld/tracy) is:
> A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

With the `trace_tracy` feature enabled, you run your bevy app and either a headless server (`capture`) or a live, interactive profiler UI (`Tracy`), and connect that to your bevy application to then stream the metric data and events, and save it or inspect it live/offline.

Previously when I implemented the spans across systems and stages and I was trying out different profiling tools, Tracy was too unstable on macOS to use. But now, quite some months later, it is working stably with Tracy 0.7.8. You can see timelines, aggregate statistics of mean system/stage execution times, and much more. It's very useful!

![Screenshot_2021-09-15_at_18 07 19](https://user-images.githubusercontent.com/302146/133554920-350d3d45-fbb8-479f-91f7-7a7a4f9f5873.png)

- Use the `tracing-tracy` crate which supports our tracing spans
- Expose via the non-default feature `trace_tracy` for consistency with other `trace*` features
superdump added a commit to superdump/bevy that referenced this pull request Oct 8, 2021
[Tracy](https://github.com/wolfpld/tracy) is:
> A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

With the `trace_tracy` feature enabled, you run your bevy app and either a headless server (`capture`) or a live, interactive profiler UI (`Tracy`), and connect that to your bevy application to then stream the metric data and events, and save it or inspect it live/offline.

Previously when I implemented the spans across systems and stages and I was trying out different profiling tools, Tracy was too unstable on macOS to use. But now, quite some months later, it is working stably with Tracy 0.7.8. You can see timelines, aggregate statistics of mean system/stage execution times, and much more. It's very useful!

![Screenshot_2021-09-15_at_18 07 19](https://user-images.githubusercontent.com/302146/133554920-350d3d45-fbb8-479f-91f7-7a7a4f9f5873.png)

- Use the `tracing-tracy` crate which supports our tracing spans
- Expose via the non-default feature `trace_tracy` for consistency with other `trace*` features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants