:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Performance.xml. .. _class_Performance: Performance =========== **Inherits:** :ref:`Object` Exposes performance-related data. .. rst-class:: classref-introduction-group 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 :ref:`get_monitor` method of this class, you can access this data from your code. \ **Note:** A few of these monitors are only available in debug mode and will always return 0 when used in a release build. \ **Note:** Many of these monitors are not updated in real-time, so there may be a short delay between changes. .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +---------------------------+-------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_monitor` **(** :ref:`Monitor` monitor **)** |const| | +---------------------------+-------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_Performance_Monitor: .. rst-class:: classref-enumeration enum **Monitor**: .. _class_Performance_constant_TIME_FPS: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **TIME_FPS** = ``0`` Number of frames per second. .. _class_Performance_constant_TIME_PROCESS: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **TIME_PROCESS** = ``1`` Time it took to complete one frame, in seconds. .. _class_Performance_constant_TIME_PHYSICS_PROCESS: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **TIME_PHYSICS_PROCESS** = ``2`` Time it took to complete one physics frame, in seconds. .. _class_Performance_constant_MEMORY_STATIC: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **MEMORY_STATIC** = ``3`` Static memory currently used, in bytes. Not available in release builds. .. _class_Performance_constant_MEMORY_DYNAMIC: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **MEMORY_DYNAMIC** = ``4`` Dynamic memory currently used, in bytes. Not available in release builds. .. _class_Performance_constant_MEMORY_STATIC_MAX: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **MEMORY_STATIC_MAX** = ``5`` Available static memory. Not available in release builds. .. _class_Performance_constant_MEMORY_DYNAMIC_MAX: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **MEMORY_DYNAMIC_MAX** = ``6`` Available dynamic memory. Not available in release builds. .. _class_Performance_constant_MEMORY_MESSAGE_BUFFER_MAX: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **MEMORY_MESSAGE_BUFFER_MAX** = ``7`` Largest amount of memory the message queue buffer has used, in bytes. The message queue is used for deferred functions calls and notifications. .. _class_Performance_constant_OBJECT_COUNT: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **OBJECT_COUNT** = ``8`` Number of objects currently instanced (including nodes). .. _class_Performance_constant_OBJECT_RESOURCE_COUNT: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **OBJECT_RESOURCE_COUNT** = ``9`` Number of resources currently used. .. _class_Performance_constant_OBJECT_NODE_COUNT: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **OBJECT_NODE_COUNT** = ``10`` Number of nodes currently instanced in the scene tree. This also includes the root node. .. _class_Performance_constant_OBJECT_ORPHAN_NODE_COUNT: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **OBJECT_ORPHAN_NODE_COUNT** = ``11`` Number of orphan nodes, i.e. nodes which are not parented to a node of the scene tree. .. _class_Performance_constant_RENDER_OBJECTS_IN_FRAME: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_OBJECTS_IN_FRAME** = ``12`` 3D objects drawn per frame. .. _class_Performance_constant_RENDER_VERTICES_IN_FRAME: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_VERTICES_IN_FRAME** = ``13`` Vertices drawn per frame. 3D only. .. _class_Performance_constant_RENDER_MATERIAL_CHANGES_IN_FRAME: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_MATERIAL_CHANGES_IN_FRAME** = ``14`` Material changes per frame. 3D only. .. _class_Performance_constant_RENDER_SHADER_CHANGES_IN_FRAME: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_SHADER_CHANGES_IN_FRAME** = ``15`` Shader changes per frame. 3D only. .. _class_Performance_constant_RENDER_SURFACE_CHANGES_IN_FRAME: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_SURFACE_CHANGES_IN_FRAME** = ``16`` Render surface changes per frame. 3D only. .. _class_Performance_constant_RENDER_DRAW_CALLS_IN_FRAME: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_DRAW_CALLS_IN_FRAME** = ``17`` Draw calls per frame. 3D only. .. _class_Performance_constant_RENDER_2D_ITEMS_IN_FRAME: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_2D_ITEMS_IN_FRAME** = ``18`` Items or joined items drawn per frame. .. _class_Performance_constant_RENDER_2D_DRAW_CALLS_IN_FRAME: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_2D_DRAW_CALLS_IN_FRAME** = ``19`` Draw calls per frame. .. _class_Performance_constant_RENDER_VIDEO_MEM_USED: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_VIDEO_MEM_USED** = ``20`` The amount of video memory used, i.e. texture and vertex memory combined. .. _class_Performance_constant_RENDER_TEXTURE_MEM_USED: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_TEXTURE_MEM_USED** = ``21`` The amount of texture memory used. .. _class_Performance_constant_RENDER_VERTEX_MEM_USED: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_VERTEX_MEM_USED** = ``22`` The amount of vertex memory used. .. _class_Performance_constant_RENDER_USAGE_VIDEO_MEM_TOTAL: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **RENDER_USAGE_VIDEO_MEM_TOTAL** = ``23`` Unimplemented in the GLES2 and GLES3 rendering backends, always returns 0. .. _class_Performance_constant_PHYSICS_2D_ACTIVE_OBJECTS: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **PHYSICS_2D_ACTIVE_OBJECTS** = ``24`` Number of active :ref:`RigidBody2D` nodes in the game. .. _class_Performance_constant_PHYSICS_2D_COLLISION_PAIRS: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **PHYSICS_2D_COLLISION_PAIRS** = ``25`` Number of collision pairs in the 2D physics engine. .. _class_Performance_constant_PHYSICS_2D_ISLAND_COUNT: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **PHYSICS_2D_ISLAND_COUNT** = ``26`` Number of islands in the 2D physics engine. .. _class_Performance_constant_PHYSICS_3D_ACTIVE_OBJECTS: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **PHYSICS_3D_ACTIVE_OBJECTS** = ``27`` Number of active :ref:`RigidBody` and :ref:`VehicleBody` nodes in the game. .. _class_Performance_constant_PHYSICS_3D_COLLISION_PAIRS: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **PHYSICS_3D_COLLISION_PAIRS** = ``28`` Number of collision pairs in the 3D physics engine. .. _class_Performance_constant_PHYSICS_3D_ISLAND_COUNT: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **PHYSICS_3D_ISLAND_COUNT** = ``29`` Number of islands in the 3D physics engine. .. _class_Performance_constant_AUDIO_OUTPUT_LATENCY: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **AUDIO_OUTPUT_LATENCY** = ``30`` Output latency of the :ref:`AudioServer`. Equivalent to calling :ref:`AudioServer.get_output_latency`, it is not recommended to call this every frame. .. _class_Performance_constant_MONITOR_MAX: .. rst-class:: classref-enumeration-constant :ref:`Monitor` **MONITOR_MAX** = ``31`` Represents the size of the :ref:`Monitor` enum. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_Performance_method_get_monitor: .. rst-class:: classref-method :ref:`float` **get_monitor** **(** :ref:`Monitor` monitor **)** |const| Returns the value of one of the available monitors. You should provide one of the :ref:`Monitor` constants as the argument, like this: :: print(Performance.get_monitor(Performance.TIME_FPS)) # Prints the FPS to the console .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`