Documentation
¶
Overview ¶
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 GetMonitor method of this class, you can access this data from your code.
You can add custom monitors using the AddCustomMonitor 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.
Index ¶
- func AddCustomMonitor(id string, callable Callable.Function, arguments []any)
- func AddCustomMonitorOptions(id string, callable Callable.Function, arguments []any)
- func Advanced() class
- func GetCustomMonitor(id string) any
- func GetCustomMonitorNames() []string
- func GetMonitor(monitor Monitor) Float.X
- func GetMonitorModificationTime() int
- func HasCustomMonitor(id string) bool
- func RemoveCustomMonitor(id string)
- type Extension
- type ID
- type Instance
- type Monitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCustomMonitor ¶
Adds a custom monitor with the name 'id'. You can specify the category of the monitor using slash delimiters in 'id' (for example: "Game/NumberOfNPCs"). If there is more than one slash delimiter, then the default category is used. The default category is "Custom". Prints an error if given 'id' is already present.
The debugger calls the callable to get the value of custom monitor. The callable must return a zero or positive integer or floating-point number.
Callables are called with arguments supplied in argument array.
func AddCustomMonitorOptions ¶
Adds a custom monitor with the name 'id'. You can specify the category of the monitor using slash delimiters in 'id' (for example: "Game/NumberOfNPCs"). If there is more than one slash delimiter, then the default category is used. The default category is "Custom". Prints an error if given 'id' is already present.
The debugger calls the callable to get the value of custom monitor. The callable must return a zero or positive integer or floating-point number.
Callables are called with arguments supplied in argument array.
func Advanced ¶
func Advanced() class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
func GetCustomMonitor ¶
Returns the value of custom monitor with given 'id'. The callable is called to get the value of custom monitor. See also HasCustomMonitor. Prints an error if the given 'id' is absent.
func GetCustomMonitorNames ¶
func GetCustomMonitorNames() []string
Returns the names of active custom monitors in an slice.
func GetMonitor ¶
Returns the value of one of the available built-in monitors. You should provide one of the Monitor constants as the argument, like this:
See GetCustomMonitor to query custom performance monitors' values.
func GetMonitorModificationTime ¶
func GetMonitorModificationTime() int
Returns the last tick in which custom monitor was added/removed (in microseconds since the engine started). This is set to graphics.gd/classdb/Time.GetTicksUsec when the monitor is updated.
func HasCustomMonitor ¶
Returns true if custom monitor with the given 'id' is present, false otherwise.
func RemoveCustomMonitor ¶
func RemoveCustomMonitor(id string)
Removes the custom monitor with given 'id'. Prints an error if the given 'id' is already absent.
Types ¶
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.Performance
Instance of the class with convieniently typed arguments and results.
type Monitor ¶
type Monitor int //gd:Performance.Monitor
const ( // 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. TimeFps Monitor = 0 // Time it took to complete one frame, in seconds. Lower is better. TimeProcess Monitor = 1 // Time it took to complete one physics frame, in seconds. Lower is better. TimePhysicsProcess Monitor = 2 TimeNavigationProcess Monitor = 3 // Static memory currently used, in bytes. Not available in release builds. Lower is better. MemoryStatic Monitor = 4 // Available static memory. Not available in release builds. Lower is better. MemoryStaticMax Monitor = 5 // 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. MemoryMessageBufferMax Monitor = 6 // Number of objects currently instantiated (including nodes). Lower is better. ObjectCount Monitor = 7 // Number of resources currently used. Lower is better. ObjectResourceCount Monitor = 8 // Number of nodes currently instantiated in the scene tree. This also includes the root node. Lower is better. ObjectNodeCount Monitor = 9 // Number of orphan nodes, i.e. nodes which are not parented to a node of the scene tree. Lower is better. ObjectOrphanNodeCount Monitor = 10 // The total number of objects in the last rendered frame. This metric doesn't include culled objects (either via hiding nodes, frustum culling or occlusion culling). Lower is better. RenderTotalObjectsInFrame Monitor = 11 // The total number of vertices or indices rendered in the last rendered frame. This metric doesn't include primitives from culled objects (either via hiding nodes, frustum culling or occlusion culling). Due to the depth prepass and shadow passes, the number of primitives is always higher than the actual number of vertices in the scene (typically double or triple the original vertex count). Lower is better. RenderTotalPrimitivesInFrame Monitor = 12 // The total number of draw calls performed in the last rendered frame. This metric doesn't include culled objects (either via hiding nodes, frustum culling or occlusion culling), since they do not result in draw calls. Lower is better. RenderTotalDrawCallsInFrame Monitor = 13 // The amount of video memory used (texture and vertex memory combined, in bytes). Since this metric also includes miscellaneous allocations, this value is always greater than the sum of [RenderTextureMemUsed] and [RenderBufferMemUsed]. Lower is better. RenderVideoMemUsed Monitor = 14 // The amount of texture memory used (in bytes). Lower is better. RenderTextureMemUsed Monitor = 15 // The amount of render buffer memory used (in bytes). Lower is better. RenderBufferMemUsed Monitor = 16 // Number of active [graphics.gd/classdb/RigidBody2D] nodes in the game. Lower is better. Physics2dActiveObjects Monitor = 17 // Number of collision pairs in the 2D physics engine. Lower is better. Physics2dCollisionPairs Monitor = 18 // Number of islands in the 2D physics engine. Lower is better. Physics2dIslandCount Monitor = 19 // Number of active [graphics.gd/classdb/RigidBody3D] and [graphics.gd/classdb/VehicleBody3D] nodes in the game. Lower is better. Physics3dActiveObjects Monitor = 20 // Number of collision pairs in the 3D physics engine. Lower is better. Physics3dCollisionPairs Monitor = 21 // Number of islands in the 3D physics engine. Lower is better. Physics3dIslandCount Monitor = 22 // Output latency of the [graphics.gd/classdb/AudioServer]. Equivalent to calling [graphics.gd/classdb/AudioServer.GetOutputLatency], it is not recommended to call this every frame. AudioOutputLatency Monitor = 23 NavigationActiveMaps Monitor = 24 NavigationRegionCount Monitor = 25 NavigationAgentCount Monitor = 26 NavigationLinkCount Monitor = 27 NavigationPolygonCount Monitor = 28 NavigationEdgeCount Monitor = 29 NavigationEdgeMergeCount Monitor = 30 NavigationEdgeConnectionCount Monitor = 31 NavigationEdgeFreeCount Monitor = 32 NavigationObstacleCount Monitor = 33 // Number of pipeline compilations that were triggered by the 2D canvas renderer. PipelineCompilationsCanvas Monitor = 34 // Number of pipeline compilations that were triggered by loading meshes. These compilations will show up as longer loading times the first time a user runs the game and the pipeline is required. PipelineCompilationsMesh Monitor = 35 // Number of pipeline compilations that were triggered by building the surface cache before rendering the scene. These compilations will show up as a stutter when loading a scene the first time a user runs the game and the pipeline is required. PipelineCompilationsSurface Monitor = 36 // Number of pipeline compilations that were triggered while drawing the scene. These compilations will show up as stutters during gameplay the first time a user runs the game and the pipeline is required. PipelineCompilationsDraw Monitor = 37 // Number of pipeline compilations that were triggered to optimize the current scene. These compilations are done in the background and should not cause any stutters whatsoever. PipelineCompilationsSpecialization Monitor = 38 Navigation2dActiveMaps Monitor = 39 Navigation2dRegionCount Monitor = 40 Navigation2dAgentCount Monitor = 41 Navigation2dLinkCount Monitor = 42 Navigation2dPolygonCount Monitor = 43 Navigation2dEdgeCount Monitor = 44 Navigation2dEdgeMergeCount Monitor = 45 Navigation2dEdgeConnectionCount Monitor = 46 Navigation2dEdgeFreeCount Monitor = 47 Navigation2dObstacleCount Monitor = 48 Navigation3dActiveMaps Monitor = 49 Navigation3dRegionCount Monitor = 50 Navigation3dAgentCount Monitor = 51 Navigation3dLinkCount Monitor = 52 Navigation3dPolygonCount Monitor = 53 Navigation3dEdgeCount Monitor = 54 Navigation3dEdgeMergeCount Monitor = 55 Navigation3dEdgeConnectionCount Monitor = 56 Navigation3dEdgeFreeCount Monitor = 57 Navigation3dObstacleCount Monitor = 58 // Represents the size of the [Monitor] enum. MonitorMax Monitor = 59 )