class_performance.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Performance.xml.
  6. .. _class_Performance:
  7. Performance
  8. ===========
  9. **Inherits:** :ref:`Object<class_Object>`
  10. Exposes performance-related data.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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<class_Performance_method_get_monitor>` method of this class, you can access this data from your code.
  15. \ **Note:** A few of these monitors are only available in debug mode and will always return 0 when used in a release build.
  16. \ **Note:** Many of these monitors are not updated in real-time, so there may be a short delay between changes.
  17. .. rst-class:: classref-reftable-group
  18. Methods
  19. -------
  20. .. table::
  21. :widths: auto
  22. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`float<class_float>` | :ref:`get_monitor<class_Performance_method_get_monitor>` **(** :ref:`Monitor<enum_Performance_Monitor>` monitor **)** |const| |
  24. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------+
  25. .. rst-class:: classref-section-separator
  26. ----
  27. .. rst-class:: classref-descriptions-group
  28. Enumerations
  29. ------------
  30. .. _enum_Performance_Monitor:
  31. .. rst-class:: classref-enumeration
  32. enum **Monitor**:
  33. .. _class_Performance_constant_TIME_FPS:
  34. .. rst-class:: classref-enumeration-constant
  35. :ref:`Monitor<enum_Performance_Monitor>` **TIME_FPS** = ``0``
  36. Number of frames per second.
  37. .. _class_Performance_constant_TIME_PROCESS:
  38. .. rst-class:: classref-enumeration-constant
  39. :ref:`Monitor<enum_Performance_Monitor>` **TIME_PROCESS** = ``1``
  40. Time it took to complete one frame, in seconds.
  41. .. _class_Performance_constant_TIME_PHYSICS_PROCESS:
  42. .. rst-class:: classref-enumeration-constant
  43. :ref:`Monitor<enum_Performance_Monitor>` **TIME_PHYSICS_PROCESS** = ``2``
  44. Time it took to complete one physics frame, in seconds.
  45. .. _class_Performance_constant_MEMORY_STATIC:
  46. .. rst-class:: classref-enumeration-constant
  47. :ref:`Monitor<enum_Performance_Monitor>` **MEMORY_STATIC** = ``3``
  48. Static memory currently used, in bytes. Not available in release builds.
  49. .. _class_Performance_constant_MEMORY_DYNAMIC:
  50. .. rst-class:: classref-enumeration-constant
  51. :ref:`Monitor<enum_Performance_Monitor>` **MEMORY_DYNAMIC** = ``4``
  52. Dynamic memory currently used, in bytes. Not available in release builds.
  53. .. _class_Performance_constant_MEMORY_STATIC_MAX:
  54. .. rst-class:: classref-enumeration-constant
  55. :ref:`Monitor<enum_Performance_Monitor>` **MEMORY_STATIC_MAX** = ``5``
  56. Available static memory. Not available in release builds.
  57. .. _class_Performance_constant_MEMORY_DYNAMIC_MAX:
  58. .. rst-class:: classref-enumeration-constant
  59. :ref:`Monitor<enum_Performance_Monitor>` **MEMORY_DYNAMIC_MAX** = ``6``
  60. Available dynamic memory. Not available in release builds.
  61. .. _class_Performance_constant_MEMORY_MESSAGE_BUFFER_MAX:
  62. .. rst-class:: classref-enumeration-constant
  63. :ref:`Monitor<enum_Performance_Monitor>` **MEMORY_MESSAGE_BUFFER_MAX** = ``7``
  64. Largest amount of memory the message queue buffer has used, in bytes. The message queue is used for deferred functions calls and notifications.
  65. .. _class_Performance_constant_OBJECT_COUNT:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`Monitor<enum_Performance_Monitor>` **OBJECT_COUNT** = ``8``
  68. Number of objects currently instanced (including nodes).
  69. .. _class_Performance_constant_OBJECT_RESOURCE_COUNT:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`Monitor<enum_Performance_Monitor>` **OBJECT_RESOURCE_COUNT** = ``9``
  72. Number of resources currently used.
  73. .. _class_Performance_constant_OBJECT_NODE_COUNT:
  74. .. rst-class:: classref-enumeration-constant
  75. :ref:`Monitor<enum_Performance_Monitor>` **OBJECT_NODE_COUNT** = ``10``
  76. Number of nodes currently instanced in the scene tree. This also includes the root node.
  77. .. _class_Performance_constant_OBJECT_ORPHAN_NODE_COUNT:
  78. .. rst-class:: classref-enumeration-constant
  79. :ref:`Monitor<enum_Performance_Monitor>` **OBJECT_ORPHAN_NODE_COUNT** = ``11``
  80. Number of orphan nodes, i.e. nodes which are not parented to a node of the scene tree.
  81. .. _class_Performance_constant_RENDER_OBJECTS_IN_FRAME:
  82. .. rst-class:: classref-enumeration-constant
  83. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_OBJECTS_IN_FRAME** = ``12``
  84. 3D objects drawn per frame.
  85. .. _class_Performance_constant_RENDER_VERTICES_IN_FRAME:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_VERTICES_IN_FRAME** = ``13``
  88. Vertices drawn per frame. 3D only.
  89. .. _class_Performance_constant_RENDER_MATERIAL_CHANGES_IN_FRAME:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_MATERIAL_CHANGES_IN_FRAME** = ``14``
  92. Material changes per frame. 3D only.
  93. .. _class_Performance_constant_RENDER_SHADER_CHANGES_IN_FRAME:
  94. .. rst-class:: classref-enumeration-constant
  95. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_SHADER_CHANGES_IN_FRAME** = ``15``
  96. Shader changes per frame. 3D only.
  97. .. _class_Performance_constant_RENDER_SURFACE_CHANGES_IN_FRAME:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_SURFACE_CHANGES_IN_FRAME** = ``16``
  100. Render surface changes per frame. 3D only.
  101. .. _class_Performance_constant_RENDER_DRAW_CALLS_IN_FRAME:
  102. .. rst-class:: classref-enumeration-constant
  103. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_DRAW_CALLS_IN_FRAME** = ``17``
  104. Draw calls per frame. 3D only.
  105. .. _class_Performance_constant_RENDER_2D_ITEMS_IN_FRAME:
  106. .. rst-class:: classref-enumeration-constant
  107. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_2D_ITEMS_IN_FRAME** = ``18``
  108. Items or joined items drawn per frame.
  109. .. _class_Performance_constant_RENDER_2D_DRAW_CALLS_IN_FRAME:
  110. .. rst-class:: classref-enumeration-constant
  111. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_2D_DRAW_CALLS_IN_FRAME** = ``19``
  112. Draw calls per frame.
  113. .. _class_Performance_constant_RENDER_VIDEO_MEM_USED:
  114. .. rst-class:: classref-enumeration-constant
  115. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_VIDEO_MEM_USED** = ``20``
  116. The amount of video memory used, i.e. texture and vertex memory combined.
  117. .. _class_Performance_constant_RENDER_TEXTURE_MEM_USED:
  118. .. rst-class:: classref-enumeration-constant
  119. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_TEXTURE_MEM_USED** = ``21``
  120. The amount of texture memory used.
  121. .. _class_Performance_constant_RENDER_VERTEX_MEM_USED:
  122. .. rst-class:: classref-enumeration-constant
  123. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_VERTEX_MEM_USED** = ``22``
  124. The amount of vertex memory used.
  125. .. _class_Performance_constant_RENDER_USAGE_VIDEO_MEM_TOTAL:
  126. .. rst-class:: classref-enumeration-constant
  127. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_USAGE_VIDEO_MEM_TOTAL** = ``23``
  128. Unimplemented in the GLES2 and GLES3 rendering backends, always returns 0.
  129. .. _class_Performance_constant_PHYSICS_2D_ACTIVE_OBJECTS:
  130. .. rst-class:: classref-enumeration-constant
  131. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_2D_ACTIVE_OBJECTS** = ``24``
  132. Number of active :ref:`RigidBody2D<class_RigidBody2D>` nodes in the game.
  133. .. _class_Performance_constant_PHYSICS_2D_COLLISION_PAIRS:
  134. .. rst-class:: classref-enumeration-constant
  135. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_2D_COLLISION_PAIRS** = ``25``
  136. Number of collision pairs in the 2D physics engine.
  137. .. _class_Performance_constant_PHYSICS_2D_ISLAND_COUNT:
  138. .. rst-class:: classref-enumeration-constant
  139. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_2D_ISLAND_COUNT** = ``26``
  140. Number of islands in the 2D physics engine.
  141. .. _class_Performance_constant_PHYSICS_3D_ACTIVE_OBJECTS:
  142. .. rst-class:: classref-enumeration-constant
  143. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_3D_ACTIVE_OBJECTS** = ``27``
  144. Number of active :ref:`RigidBody<class_RigidBody>` and :ref:`VehicleBody<class_VehicleBody>` nodes in the game.
  145. .. _class_Performance_constant_PHYSICS_3D_COLLISION_PAIRS:
  146. .. rst-class:: classref-enumeration-constant
  147. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_3D_COLLISION_PAIRS** = ``28``
  148. Number of collision pairs in the 3D physics engine.
  149. .. _class_Performance_constant_PHYSICS_3D_ISLAND_COUNT:
  150. .. rst-class:: classref-enumeration-constant
  151. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_3D_ISLAND_COUNT** = ``29``
  152. Number of islands in the 3D physics engine.
  153. .. _class_Performance_constant_AUDIO_OUTPUT_LATENCY:
  154. .. rst-class:: classref-enumeration-constant
  155. :ref:`Monitor<enum_Performance_Monitor>` **AUDIO_OUTPUT_LATENCY** = ``30``
  156. Output latency of the :ref:`AudioServer<class_AudioServer>`. Equivalent to calling :ref:`AudioServer.get_output_latency<class_AudioServer_method_get_output_latency>`, it is not recommended to call this every frame.
  157. .. _class_Performance_constant_MONITOR_MAX:
  158. .. rst-class:: classref-enumeration-constant
  159. :ref:`Monitor<enum_Performance_Monitor>` **MONITOR_MAX** = ``31``
  160. Represents the size of the :ref:`Monitor<enum_Performance_Monitor>` enum.
  161. .. rst-class:: classref-section-separator
  162. ----
  163. .. rst-class:: classref-descriptions-group
  164. Method Descriptions
  165. -------------------
  166. .. _class_Performance_method_get_monitor:
  167. .. rst-class:: classref-method
  168. :ref:`float<class_float>` **get_monitor** **(** :ref:`Monitor<enum_Performance_Monitor>` monitor **)** |const|
  169. Returns the value of one of the available monitors. You should provide one of the :ref:`Monitor<enum_Performance_Monitor>` constants as the argument, like this:
  170. ::
  171. print(Performance.get_monitor(Performance.TIME_FPS)) # Prints the FPS to the console
  172. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  173. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  174. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  175. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`