-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add documentation on how to use Tracy and Perfetto #11484
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
base: master
Are you sure you want to change the base?
Conversation
44dee1c to
2b21a42
Compare
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/sampling_profilers.rst
Outdated
Show resolved
Hide resolved
00cf4f1 to
74c46a5
Compare
|
I've filled in the docs for Tracy now too, so taking this out of draft! Given that I've only just tried Tracy for the first time, I'm very curious to hear if I'm using it correctly or not :-) |
aa775c7 to
e5bd5a8
Compare
Ivorforce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good!
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/tracing_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/sampling_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/sampling_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/sampling_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/sampling_profilers.rst
Outdated
Show resolved
Hide resolved
engine_details/development/debugging/profiling/sampling_profilers.rst
Outdated
Show resolved
Hide resolved
6bbb449 to
3b017d0
Compare
|
@Ivorforce @AThousandShips Thanks for the review! I think I've integrated all your feedback in my latest push :-) |
Ivorforce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
| @@ -1,3 +1,3 @@ | |||
| .. _doc_using_cpp_profilers: | |||
|
|
|||
| Using C++ profilers | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should C++ be dropped from the page title and page path since both sampling and tracing profilers can be used for more than C++ applications and the Godot codebase contains other languages besides C++.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the "C++" is in there to distinguish it from Godot's profiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the section is explicit enough that we could drop C++. For example, in the same section we have a using sanitizers page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think sanitizers is a little different, though: there isn't a "Godot sanitizer" and "C++ sanitizers", whereas we do have a "Godot profiler" and "C++ profilers"
However, if we do rename it, I assume we'd want to keep the path the same so we don't have to deal with redirects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, if we do rename it, I assume we'd want to keep the path the same so we don't have to deal with redirects?
yeah, keep things simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the page title isn't from this PR (it's pre-existing), I don't think we need to resolve this here. The title can be addressed in another PR
| To learn more, see the | ||
| `Tracy manual <https://github.com/wolfpld/tracy/releases/latest/download/tracy.pdf>`_. | ||
|
|
||
| Perfetto for Android |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth including that it supports Win/Mac/Linux as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the way Godot has integrated it (at least so far) really supports Windows and Mac. It's setup to use the "system" backend, which requires connecting with Perfetto's system daemon which I think is only Linux and Android. If we added support for the "in process" backend we could add docs for how to use that later? The steps for using it would be somewhat different
| This will create a ``perfetto`` directory - you can place this anywhere. | ||
|
|
||
| Next, build the Android debug or release templates for your architecture using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are debug symbols not required for Perfetto?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! Debug symbols are not required for Perfetto, or Tracy either, if you just use its tracing stuff and not its sampling features
AThousandShips
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
engine_details/development/debugging/profiling/sampling_profilers.rst
Outdated
Show resolved
Hide resolved
3b017d0 to
85dcccc
Compare
85dcccc to
5a3f3b8
Compare
5a3f3b8 to
ed378b8
Compare
|
When I previously used a Tracy integration, GDExtensions could not reload. (At least on Linux, I'm not sure about Windows). If this is still true, it may be worth mentioning. |
|
Did you use the Tracy Gdextension? |
|
|
Aha, that should explain it. |
|
Oh my bad, I misinterpreted your question. I actually had it compiled as a custom module, not as GDExtension. |
AdriaandeJongh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followed the guide but didn't get tracy to work unfortunately. As I am now stuck, and with little knowledge of what went wrong where, perhaps a bit of info on common mistakes or troubleshooting would be in order? It would help if I'd know what actually went wrong so I could make a more specific suggestion...
| Record a trace | ||
| ~~~~~~~~~~~~~~ | ||
|
|
||
| Launch the Tracy server - you'll see something like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 'just launch the server!' is a bit too casual for users like me. I went down a rabbit hole just to discover that the previous cmake compile steps place a binary at tracy/profiler/build/tracy-profiler which is the thing you'll want to launch. Might be good to add that here somehow.
|
|
||
| The full details can be found in the | ||
| `Tracy manual <https://github.com/wolfpld/tracy/releases/latest/download/tracy.pdf>`_, | ||
| but here is the TL;DR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TL;DR should IMO also contain that you need to install CMake. The easiest way to do that is using a Homebrew command, eg. brew install cmake.
| that is exhibiting performance issues), wait before pressing the button. | ||
|
|
||
| Now, export your game using the release templates you built above, and run it. | ||
| As soon as both are running, and you have pressed the "Connect" button in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did all the steps precisely as explained, and yet tracy gets stuck in 'Waiting for connection' after pressing the connect button. Perhaps some basic info on troubleshooting is in order here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a bit of a checklist:
- make sure you compiled the export templates with the right scons arguments
- make sure you export your game using the custom export template
- ... ?
or maybe this is too convoluted, idk.
AdriaandeJongh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it to work! There was an important scons argument missing from this guide. Other than that I think the guide is pretty good! Thanks a lot @dsnopek!
| Next, build the release templates for your platform using ``scons``, but adding | ||
| the ``profiler_path=path/to/tracy`` argument with the real path to the ``tracy`` | ||
| directory, as well as ``debug_symbols=yes`` to allow Tracy's sampling features | ||
| to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another required argument that is missing from this guide: profiler=tracy. Might also have to be set for the other profilers (I don't know) but for this one I confirmed it to be the reason I wasn't able to get tracy to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, this argument was only added recently. Other profilers also need it (profiler=perfetto, as well as profiler=instruments, although I think instruments should be documented in a follow-up PR by Stuart).
| If you press "Connect" now, you can profile the launch of Godot. However, | ||
| if you want to profile something specific (for example, a part of your game | ||
| that is exhibiting performance issues), wait before pressing the button. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just learned from a comment on the PR (+ the manual) that by default, tracy just stashes the profiler results until a server connection is made. So starting the server later (instead of immediately) just leads to RAM issues.
For now, I'd say we can change the formulation to ask users to profile immediately to avoid issues. In the future, we may want to add support for TRACY_ON_DEMAND (which makes profiling slower but supports launching the server later without RAM bloat).
Maybe something like this?
| If you press "Connect" now, you can profile the launch of Godot. However, | |
| if you want to profile something specific (for example, a part of your game | |
| that is exhibiting performance issues), wait before pressing the button. | |
| Press "connect". This will ensure tracy makes a connection immediately when the game launches. If you forget to press "connect", tracy will store system events in RAM, which can quickly blow up your memory usage (see ``TRACY_ON_DEMAND`` documentation). |

This takes the existing
using_cpp_profilers.rstand moves it to be about "Sampling profilers" (sampling_profilers.rst), so that a new page can be added about "Tracing profilers" (like Perfetto and Tracy!) and makes the old URL into an index that explains the difference and links to both pages.This is marked as DRAFT for the moment, because it only covers Perfetto - I actually haven't had a chance try Tracy yet :-)