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

Initial version of the in-game profiler #3674

Merged
merged 11 commits into from Feb 27, 2022

Conversation

Garanas
Copy link
Member

@Garanas Garanas commented Feb 22, 2022

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).

image

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:

  • Introduction of stamps, allows a user to create a timestamp and compare them
  • Introduction of benchmarks, allows a user to run the benchmarks shipped with the repository or benchmarks in active mods
  • introduction of advanced options, such as storing all the intermediate data and perform a JSON dump. Another software can interpret that dump and then create graphs, or other interesting interactions

The profiler can be enabled in any game, assuming one of these conditions are met:

  • Cheats are enabled
  • The game has one or more AIs
  • A player named 'Jip' is in the game

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.

image

A short introduction on the overview. From left to right: name, source, scope, value and growth. 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 is math.abs, where abs is a field of math.

In order to open the profiler you need to set at least one key binding:

image

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 to K). This will not close the window, just stops the data stream.

@Garanas Garanas mentioned this pull request Feb 23, 2022
@Garanas Garanas merged commit d434ec2 into deploy/fafdevelop Feb 27, 2022
@Garanas Garanas deleted the introduction-of-profiler branch March 26, 2022 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant