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

@@ -98,9 +98,10 @@ struct ObjectSpec {
/** Object scope resolver. */
struct ObjectScopeResolver : public ScopeResolver {
struct Object *obj; ///< The object the callback is ran for.
TileIndex tile; ///< The tile related to the object.
uint8 view; ///< The view of the object.
struct Object *obj; ///< The object the callback is ran for.
const ObjectSpec *spec; ///< Specification of the object type.
TileIndex tile; ///< The tile related to the object.
uint8 view; ///< The view of the object.
/**
* Constructor of an object scope resolver.
@@ -109,8 +110,8 @@ struct ObjectScopeResolver : public ScopeResolver {
* @param tile %Tile of the object.
* @param view View of the object.
*/
ObjectScopeResolver(ResolverObject &ro, Object *obj, TileIndex tile, uint8 view = 0)
: ScopeResolver(ro), obj(obj), tile(tile), view(view)
ObjectScopeResolver(ResolverObject &ro, Object *obj, const ObjectSpec *spec, TileIndex tile, uint8 view = 0)
: ScopeResolver(ro), obj(obj), spec(spec), tile(tile), view(view)
{
}
@@ -144,6 +145,9 @@ struct ObjectResolverObject : public ResolverObject {
}
}
GrfSpecFeature GetFeature() const override;
uint32 GetDebugID() const override;
private:
TownScopeResolver *GetTown();
};