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:

committed by
GitHub

parent
f88ac83408
commit
c8779fb311
@@ -56,13 +56,14 @@ extern SpriteGroupPool _spritegroup_pool;
|
||||
/* Common wrapper for all the different sprite group types */
|
||||
struct SpriteGroup : SpriteGroupPool::PoolItem<&_spritegroup_pool> {
|
||||
protected:
|
||||
SpriteGroup(SpriteGroupType type) : type(type) {}
|
||||
SpriteGroup(SpriteGroupType type) : nfo_line(0), type(type) {}
|
||||
/** Base sprite group resolver */
|
||||
virtual const SpriteGroup *Resolve(ResolverObject &object) const { return this; };
|
||||
|
||||
public:
|
||||
virtual ~SpriteGroup() {}
|
||||
|
||||
uint32 nfo_line;
|
||||
SpriteGroupType type;
|
||||
|
||||
virtual SpriteID GetResult() const { return 0; }
|
||||
@@ -398,6 +399,18 @@ struct ResolverObject {
|
||||
this->used_triggers = 0;
|
||||
memset(this->reseed, 0, sizeof(this->reseed));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the feature number being resolved for.
|
||||
* This function is mainly intended for the callback profiling feature.
|
||||
*/
|
||||
virtual GrfSpecFeature GetFeature() const { return GSF_INVALID; }
|
||||
/**
|
||||
* Get an identifier for the item being resolved.
|
||||
* This function is mainly intended for the callback profiling feature,
|
||||
* and should return an identifier recognisable by the NewGRF developer.
|
||||
*/
|
||||
virtual uint32 GetDebugID() const { return 0; }
|
||||
};
|
||||
|
||||
#endif /* NEWGRF_SPRITEGROUP_H */
|
||||
|
Reference in New Issue
Block a user