OpenTTD Source  1.11.0-beta2
framerate_gui.cpp File Reference
#include "framerate_type.h"
#include <chrono>
#include "gfx_func.h"
#include "window_gui.h"
#include "window_func.h"
#include "table/sprites.h"
#include "string_func.h"
#include "strings_func.h"
#include "console_func.h"
#include "console_type.h"
#include "guitimer_func.h"
#include "company_base.h"
#include "ai/ai_info.hpp"
#include "ai/ai_instance.hpp"
#include "game/game.hpp"
#include "game/game_instance.hpp"
#include "widgets/framerate_widget.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  anonymous_namespace{framerate_gui.cpp}::PerformanceData
 
struct  FramerateWindow
 
struct  FramerateWindow::CachedDecimal
 
struct  FrametimeGraphWindow
 

Namespaces

 anonymous_namespace{framerate_gui.cpp}
 Private declarations for performance measurement implementation.
 

Functions

static TimingMeasurement GetPerformanceTimer ()
 Return a timestamp with TIMESTAMP_PRECISION ticks per second precision. More...
 
void ShowFrametimeGraphWindow (PerformanceElement elem)
 Open a graph window for a performance element.
 
static const char * GetAIName (int ai_index)
 
void ShowFramerateWindow ()
 Open the general framerate window.
 
void ConPrintFramerate ()
 Print performance statistics to game console.
 

Variables

const int anonymous_namespace{framerate_gui.cpp}::NUM_FRAMERATE_POINTS = 512
 Number of data points to keep in buffer for each performance measurement.
 
const TimingMeasurement anonymous_namespace{framerate_gui.cpp}::TIMESTAMP_PRECISION = 1000000
 Units a second is divided into in performance measurements
 
static const double anonymous_namespace{framerate_gui.cpp}::GL_RATE = 1000.0 / MILLISECONDS_PER_TICK
 Game loop rate, cycles per second
 
PerformanceData anonymous_namespace{framerate_gui.cpp}::_pf_data [PFE_MAX]
 Storage for all performance element measurements. More...
 
static const PerformanceElement DISPLAY_ORDER_PFE [PFE_MAX]
 
static const NWidgetPart _framerate_window_widgets []
 
static WindowDesc _framerate_display_desc (WDP_AUTO, "framerate_display", 0, 0, WC_FRAMERATE_DISPLAY, WC_NONE, 0, _framerate_window_widgets, lengthof(_framerate_window_widgets))
 
static const NWidgetPart _frametime_graph_window_widgets []
 
static WindowDesc _frametime_graph_window_desc (WDP_AUTO, "frametime_graph", 140, 90, WC_FRAMETIME_GRAPH, WC_NONE, 0, _frametime_graph_window_widgets, lengthof(_frametime_graph_window_widgets))
 

Detailed Description

GUI for displaying framerate/game speed information.

Definition in file framerate_gui.cpp.

Function Documentation

◆ GetPerformanceTimer()

static TimingMeasurement GetPerformanceTimer ( )
static

Return a timestamp with TIMESTAMP_PRECISION ticks per second precision.

The basis of the timestamp is implementation defined, but the value should be steady, so differences can be taken to reliably measure intervals.

Definition at line 223 of file framerate_gui.cpp.

Referenced by PerformanceMeasurer::Paused(), PerformanceAccumulator::PerformanceAccumulator(), PerformanceMeasurer::PerformanceMeasurer(), PerformanceAccumulator::Reset(), PerformanceAccumulator::~PerformanceAccumulator(), and PerformanceMeasurer::~PerformanceMeasurer().