Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Performance

Inherits: Object

Exposes performance-related data.

Description

This class provides access to a number of different monitors related to performance, such as memory usage, draw calls, and FPS. These are the same as the values displayed in the Monitor tab in the editor's Debugger panel. By using the get_monitor method of this class, you can access this data from your code.

You can add custom monitors using the add_custom_monitor method. Custom monitors are available in Monitor tab in the editor's Debugger panel together with built-in monitors.

Note: Some of the built-in monitors are only available in debug mode and will always return 0 when used in a project exported in release mode.

Note: Some of the built-in monitors are not updated in real-time for performance reasons, so there may be a delay of up to 1 second between changes.

Note: Custom monitors do not support negative values. Negative values are clamped to 0.

Methods

void

add_custom_monitor ( StringName id, Callable callable, Array arguments=[] )

Variant

get_custom_monitor ( StringName id )

StringName[]

get_custom_monitor_names ( )

float

get_monitor ( Monitor monitor ) const

int

get_monitor_modification_time ( )

bool

has_custom_monitor ( StringName id )

void

remove_custom_monitor ( StringName id )


Enumerations

enum Monitor:

Monitor TIME_FPS = 0

The number of frames rendered in the last second. This metric is only updated once per second, even if queried more often. Higher is better.

Monitor TIME_PROCESS = 1

Time it took to complete one frame, in seconds. Lower is better.

Monitor TIME_PHYSICS_PROCESS = 2

Time it took to complete one physics frame, in seconds. Lower is better.

Monitor TIME_NAVIGATION_PROCESS = 3

Time it took to complete one navigation step, in seconds. This includes navigation map updates as well as agent avoidance calculations. Lower is better.

Monitor MEMORY_STATIC = 4

Static memory currently used, in bytes. Not available in release builds. Lower is better.

Monitor MEMORY_STATIC_MAX = 5

Available static memory. Not available in release builds. Lower is better.

Monitor MEMORY_MESSAGE_BUFFER_MAX = 6

Largest amount of memory the message queue buffer has used, in bytes. The message queue is used for deferred functions calls and notifications. Lower is better.

Monitor OBJECT_COUNT = 7