OpenTTD Source  1.11.0-beta2
framerate_type.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7 
35 #ifndef FRAMERATE_TYPE_H
36 #define FRAMERATE_TYPE_H
37 
38 #include "stdafx.h"
39 #include "core/enum_type.hpp"
40 
48  PFE_FIRST = 0,
79 };
81 
82 
83 typedef uint64 TimingMeasurement;
84 
93  PerformanceElement elem;
94  TimingMeasurement start_time;
95 public:
98  void SetExpectedRate(double rate);
99  static void SetInactive(PerformanceElement elem);
100  static void Paused(PerformanceElement elem);
101 };
102 
115  PerformanceElement elem;
116  TimingMeasurement start_time;
117 public:
120  static void Reset(PerformanceElement elem);
121 };
122 
123 void ShowFramerateWindow();
124 
125 #endif /* FRAMERATE_TYPE_H */
PFE_AI11
@ PFE_AI11
AI execution for player slot 12.
Definition: framerate_type.h:74
PFE_AI9
@ PFE_AI9
AI execution for player slot 10.
Definition: framerate_type.h:72
PFE_VIDEO
@ PFE_VIDEO
Speed of painting drawn video buffer.
Definition: framerate_type.h:59
PFE_AI14
@ PFE_AI14
AI execution for player slot 15.
Definition: framerate_type.h:77
PFE_AI1
@ PFE_AI1
AI execution for player slot 2.
Definition: framerate_type.h:64
PFE_GL_ROADVEHS
@ PFE_GL_ROADVEHS
Time spend processing road vehicles.
Definition: framerate_type.h:52
PerformanceMeasurer
RAII class for measuring simple elements of performance.
Definition: framerate_type.h:92
PFE_GL_LINKGRAPH
@ PFE_GL_LINKGRAPH
Time spent waiting for link graph background jobs.
Definition: framerate_type.h:56
PerformanceAccumulator::~PerformanceAccumulator
~PerformanceAccumulator()
Finish and add one block of the accumulating value.
Definition: framerate_gui.cpp:294
PFE_GL_LANDSCAPE
@ PFE_GL_LANDSCAPE
Time spent processing other world features.
Definition: framerate_type.h:55
PerformanceElement
PerformanceElement
Elements of game performance that can be measured.
Definition: framerate_type.h:47
PFE_GL_TRAINS
@ PFE_GL_TRAINS
Time spent processing trains.
Definition: framerate_type.h:51
DECLARE_POSTFIX_INCREMENT
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition: enum_type.hpp:14
PFE_AI7
@ PFE_AI7
AI execution for player slot 8.
Definition: framerate_type.h:70
PFE_GL_SHIPS
@ PFE_GL_SHIPS
Time spent processing ships.
Definition: framerate_type.h:53
PFE_AI2
@ PFE_AI2
AI execution for player slot 3.
Definition: framerate_type.h:65
PFE_DRAWING
@ PFE_DRAWING
Speed of drawing world and GUI.
Definition: framerate_type.h:57
PFE_AI12
@ PFE_AI12
AI execution for player slot 13.
Definition: framerate_type.h:75
PFE_GL_AIRCRAFT
@ PFE_GL_AIRCRAFT
Time spent processing aircraft.
Definition: framerate_type.h:54
PFE_AI10
@ PFE_AI10
AI execution for player slot 11.
Definition: framerate_type.h:73
PFE_MAX
@ PFE_MAX
End of enum, must be last.
Definition: framerate_type.h:78
stdafx.h
PerformanceAccumulator
RAII class for measuring multi-step elements of performance.
Definition: framerate_type.h:114
PFE_GAMESCRIPT
@ PFE_GAMESCRIPT
Game script execution.
Definition: framerate_type.h:62
PerformanceAccumulator::PerformanceAccumulator
PerformanceAccumulator(PerformanceElement elem)
Begin measuring one block of the accumulating value.
Definition: framerate_gui.cpp:285
PFE_SOUND
@ PFE_SOUND
Speed of mixing audio samples.
Definition: framerate_type.h:60
PFE_GAMELOOP
@ PFE_GAMELOOP
Speed of gameloop processing.
Definition: framerate_type.h:49
PFE_AI8
@ PFE_AI8
AI execution for player slot 9.
Definition: framerate_type.h:71
PFE_GL_ECONOMY
@ PFE_GL_ECONOMY
Time spent processing cargo movement.
Definition: framerate_type.h:50
TimingMeasurement
uint64 TimingMeasurement
Type used to hold a performance timing measurement.
Definition: framerate_type.h:83
ShowFramerateWindow
void ShowFramerateWindow()
Open the general framerate window.
Definition: framerate_gui.cpp:1008
PFE_AI3
@ PFE_AI3
AI execution for player slot 4.
Definition: framerate_type.h:66
PFE_AI6
@ PFE_AI6
AI execution for player slot 7.
Definition: framerate_type.h:69
PFE_ALLSCRIPTS
@ PFE_ALLSCRIPTS
Sum of all GS/AI scripts.
Definition: framerate_type.h:61
enum_type.hpp
PFE_AI5
@ PFE_AI5
AI execution for player slot 6.
Definition: framerate_type.h:68
PerformanceAccumulator::Reset
static void Reset(PerformanceElement elem)
Store the previous accumulator value and reset for a new cycle of accumulating measurements.
Definition: framerate_gui.cpp:304
PFE_AI13
@ PFE_AI13
AI execution for player slot 14.
Definition: framerate_type.h:76
PFE_AI4
@ PFE_AI4
AI execution for player slot 5.
Definition: framerate_type.h:67
PFE_AI0
@ PFE_AI0
AI execution for player slot 1.
Definition: framerate_type.h:63
PFE_DRAWWORLD
@ PFE_DRAWWORLD
Time spent drawing world viewports in GUI.
Definition: framerate_type.h:58