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

Add benchsimulate command #10700

Open
wants to merge 1 commit into
base: develop
from
Open

Conversation

@janisozaur
Copy link
Member

janisozaur commented Feb 13, 2020

Adds a new command, benchsimulate, that starts benchmarking
UpdateLogic() function.

Adds a new command, `benchsimulate`, that starts benchmarking
UpdateLogic() function.
@janisozaur janisozaur force-pushed the janisozaur:benchsimulate branch from 8722d80 to b6a5fed Feb 13, 2020
@ZehMatt

This comment has been minimized.

Copy link
Contributor

ZehMatt commented Feb 14, 2020

Is there a way to annotate/tag a certain event during the profiling? The UpdateLogic function has like a bunch of sub-updates and it would be nice to know which one of them performs terrible, heres a list:

date_update
scenario_update
map_update_tiles
map_remove_provisional_elements
map_update_path_wide_flags
peep_update_all
map_restore_provisional_elements
vehicle_update_all
sprite_misc_update_all
research_update
ride_ratings_update_all
ride_measurements_update

There are quite a few, so it would be nice to know what is what.

@janisozaur

This comment has been minimized.

Copy link
Member Author

janisozaur commented Feb 14, 2020

I see two ways to provide this:

  1. Add explicit benchmarks for each of those
  • note that testing a single function out of the bunch could lead to results different than the current approach of using UpdateLogic(), as they likely touch same data (think: updating the peeps but not vehicles they're in could lead to unexpected results)
  1. Use manual timing (a feature of gbench) and collect timings for each relevant section
  • this could be reused to expose some timing details in-game (see how it's done in OpenTTD https://imgur.com/gallery/tyI3Htc)
  • collect them to a map so they values can be given names without having to change underlying structure
  • display them using gbench's custom counters
}
}
// Update argc with all the changes made
argc = (int)argv_for_benchmark.size();

This comment has been minimized.

Copy link
@tupaschoal

tupaschoal Feb 15, 2020

Contributor

Use named cast?


static exitcode_t HandleBenchUpdate(CommandLineArgEnumerator* argEnumerator)
{
const char** argv = (const char**)argEnumerator->GetArguments() + argEnumerator->GetIndex();

This comment has been minimized.

Copy link
@tupaschoal

tupaschoal Feb 15, 2020

Contributor

Use named cast?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.