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

@@ -352,7 +352,7 @@ unhandled:
*/
ObjectResolverObject::ObjectResolverObject(const ObjectSpec *spec, Object *obj, TileIndex tile, uint8 view,
CallbackID callback, uint32 param1, uint32 param2)
: ResolverObject(spec->grf_prop.grffile, callback, param1, param2), object_scope(*this, obj, tile, view)
: ResolverObject(spec->grf_prop.grffile, callback, param1, param2), object_scope(*this, obj, spec, tile, view)
{
this->town_scope = nullptr;
this->root_spritegroup = (obj == nullptr && spec->grf_prop.spritegroup[CT_PURCHASE_OBJECT] != nullptr) ?
@@ -384,6 +384,16 @@ TownScopeResolver *ObjectResolverObject::GetTown()
return this->town_scope;
}
GrfSpecFeature ObjectResolverObject::GetFeature() const
{
return GSF_OBJECTS;
}
uint32 ObjectResolverObject::GetDebugID() const
{
return this->object_scope.spec->grf_prop.local_id;
}
/**
* Perform a callback for an object.
* @param callback The callback to perform.