Types for recording game performance data.
More...
Go to the source code of this file.
|
enum | PerformanceElement {
PFE_FIRST = 0,
PFE_GAMELOOP = 0,
PFE_GL_ECONOMY,
PFE_GL_TRAINS,
PFE_GL_ROADVEHS,
PFE_GL_SHIPS,
PFE_GL_AIRCRAFT,
PFE_GL_LANDSCAPE,
PFE_GL_LINKGRAPH,
PFE_DRAWING,
PFE_DRAWWORLD,
PFE_VIDEO,
PFE_SOUND,
PFE_MAX
} |
| Elements of game performance that can be measured. More...
|
|
Types for recording game performance data.
- Adding new measurements
- Adding a new measurement requires multiple steps, which are outlined here. The first thing to do is add a new member of the PerformanceElement enum. It must be added before
PFE_MAX
and should be added in a logical place. For example, an element of the game loop would be added next to the other game loop elements, and a rendering element next to the other rendering elements.
- Second is adding a member to the _pf_data array, in the same position as the new PerformanceElement member.
- Third is adding strings for the new element. There is an array in ConPrintFramerate with strings used for the console command. Additionally, there are two sets of strings in
english.txt
for two GUI uses, also in the PerformanceElement order. Search for STR_FRAMERATE_GAMELOOP
and STR_FRAMETIME_CAPTION_GAMELOOP
in english.txt
to find those.
- Last is actually adding the measurements. There are two ways to measure, either one-shot (a single function/block handling all processing), or as an accumulated element (multiple functions/blocks that need to be summed across each frame/tick). Use either the PerformanceMeasurer or the PerformanceAccumulator class respectively for the two cases. Either class is used by instantiating an object of it at the beginning of the block to be measured, so it auto-destructs at the end of the block. For PerformanceAccumulator, make sure to also call PerformanceAccumulator::Reset once at the beginning of a new frame. Usually the StateGameLoop function is appropriate for this.
- See also
- framerate_gui.cpp for implementation
Definition in file framerate_type.h.
◆ PerformanceElement
Elements of game performance that can be measured.
- Note
- When adding new elements here, make sure to also update all other locations depending on the length and order of this enum. See Adding new measurements above.
Enumerator |
---|
PFE_GAMELOOP | Speed of gameloop processing.
|
PFE_GL_ECONOMY | Time spent processing cargo movement.
|
PFE_GL_TRAINS | Time spent processing trains.
|
PFE_GL_ROADVEHS | Time spend processing road vehicles.
|
PFE_GL_SHIPS | Time spent processing ships.
|
PFE_GL_AIRCRAFT | Time spent processing aircraft.
|
PFE_GL_LANDSCAPE | Time spent processing other world features.
|
PFE_GL_LINKGRAPH | Time spent waiting for link graph background jobs.
|
PFE_DRAWING | Speed of drawing world and GUI.
|
PFE_DRAWWORLD | Time spent drawing world viewports in GUI.
|
PFE_VIDEO | Speed of painting drawn video buffer.
|
PFE_SOUND | Speed of mixing audio samples.
|
PFE_MAX | End of enum, must be last.
|
Definition at line 49 of file framerate_type.h.