Feature: NewGRF callback profiling (#7868)

Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
This commit is contained in:
Niels Martin Hansen
2020-01-26 13:45:51 +01:00
committed by GitHub
parent f88ac83408
commit c8779fb311
40 changed files with 691 additions and 20 deletions

View File

@@ -22,6 +22,7 @@ struct AirportTileScopeResolver : public ScopeResolver {
struct Station *st; ///< %Station of the airport for which the callback is run, or \c nullptr for build gui.
byte airport_id; ///< Type of airport for which the callback is run.
TileIndex tile; ///< Tile for the callback, only valid for airporttile callbacks.
const AirportTileSpec *ats;
/**
* Constructor of the scope resolver specific for airport tiles.
@@ -30,7 +31,7 @@ struct AirportTileScopeResolver : public ScopeResolver {
* @param st Station of the airport for which the callback is run, or \c nullptr for build gui.
*/
AirportTileScopeResolver(ResolverObject &ro, const AirportTileSpec *ats, TileIndex tile, Station *st)
: ScopeResolver(ro), st(st), tile(tile)
: ScopeResolver(ro), st(st), tile(tile), ats(ats)
{
assert(st != nullptr);
this->airport_id = st->airport.type;
@@ -54,6 +55,9 @@ struct AirportTileResolverObject : public ResolverObject {
default: return ResolverObject::GetScope(scope, relative);
}
}
GrfSpecFeature GetFeature() const override;
uint32 GetDebugID() const override;
};
/**