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
Feature: NewGRF callback profiling #7868
Conversation
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.
Such feature will totally be helpful for more complex NewGRFs and their profiling :)
Just extra info... CB IDs: https://github.com/OpenTTD/OpenTTD/blob/master/src/newgrf_callbacks.h#L20 Filesize: 30 days of Horse profiling (in a small game) gives 3m line csv. Some Excel versions, Apple Numbers etc won't open large files (the limit is sometimes 65k). Libre Office, some Excel versions might do more. I'm thinking that grf authors will find it better to write a python script to summarise the data, or maybe a jupyter notebook or similar. |
Yes, but the deficiencies of spreadsheet programmes should not limit us in our debug output :) |
How about "GetDebugID"? |
This reverts commit b9e01e9.
Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
…and local id to output
…ent GRF feature for generic callbacks
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.
Code looks fine, would like to get @frosch123's OK first though...
I experimented a bit with this last week. |
I think most NML GRFs will have automatically assigned item id's, but it really ought to be the value you can use to figure out which specific engine, industry tile, or whatever, that's causing the activity. |
I'm unsure if it's okay to squash this to one commit (it's a large changeset), or if I should put in the effort to try make logical commits. I don't think there is much to separate out. |
Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
Adds a console command
newgrf_profile
to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.I'm not entirely sure if this is useful or not, hopefully someone can try it out and decide. It should have almost no impact on performance when not in use. The console command requires developer tools to be enabled.
Careful, the CSV files can get very large very fast :) One small-ish test game with (a beta of) Iron Horse being profiled made a CSV file of 8 MB with more than 460k events recorded across 7 in-game days.