Initial version of the in-game profiler #3674
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A profiler written from the ground up, with inspiration from this profiler:
It works with vanilla Steam, this allows us to make comparisons between LOUD and FAF. That, in turn, would allow us to evaluate what they're doing right (and what we're doing wrong).
The profiler is by no means finished - only the overview is working at the moment. The overview contains a count on all the sim calls and how much they've been called in the past ten ticks (one second). You can search through them and adjust their sorting order based on their name, count and growth. The search is not case sensitive.
Future pull requests will improve the profiler:
The profiler can be enabled in any game, assuming one of these conditions are met:
The last one is in there to allow me to profile live games. For all obvious reasons - abuse of that can be reported to moderation.
The profiler has no performance impact when it is disabled. It is enabled when opening the window. You can toggle it on / off during the game. There is a performance impact when toggled on: this ranges between 20% - 40% additional overhead. Note that this profiler does not take into account time. It only takes into account the number of calls to a given function.
A short introduction on the overview. From left to right:
name
,source
,scope
,value
andgrowth
. The name of the function is by all means the name of the function. The source describes whether it is a C function, a Lua function or part of the main Lua thread (that one is rare). The scope describes how the function is accessed: as a global, as an up value (part of a closure), as an local, as a field or as a method. A method is an anonymous function. A field ismath.abs
, whereabs
is a field ofmath
.In order to open the profiler you need to set at least one key binding:
When the profiler window is toggled the profiler starts too (that one is set to
Y
in the screenshot). You can toggle the profiler on / off with the other key binding (that is set toK
). This will not close the window, just stops the data stream.