class_performance.rst 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/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. You can add custom monitors using the :ref:`add_custom_monitor()<class_Performance_method_add_custom_monitor>` method. Custom monitors are available in **Monitor** tab in the editor's **Debugger** panel together with built-in monitors.
  16. \ **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.
  17. \ **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.
  18. \ **Note:** Custom monitors do not support negative values. Negative values are clamped to 0.
  19. .. rst-class:: classref-reftable-group
  20. Methods
  21. -------
  22. .. table::
  23. :widths: auto
  24. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | |void| | :ref:`add_custom_monitor<class_Performance_method_add_custom_monitor>`\ (\ id\: :ref:`StringName<class_StringName>`, callable\: :ref:`Callable<class_Callable>`, arguments\: :ref:`Array<class_Array>` = [], type\: :ref:`MonitorType<enum_Performance_MonitorType>` = 0\ ) |
  26. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Variant<class_Variant>` | :ref:`get_custom_monitor<class_Performance_method_get_custom_monitor>`\ (\ id\: :ref:`StringName<class_StringName>`\ ) |
  28. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] | :ref:`get_custom_monitor_names<class_Performance_method_get_custom_monitor_names>`\ (\ ) |
  30. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_custom_monitor_types<class_Performance_method_get_custom_monitor_types>`\ (\ ) |
  32. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`float<class_float>` | :ref:`get_monitor<class_Performance_method_get_monitor>`\ (\ monitor\: :ref:`Monitor<enum_Performance_Monitor>`\ ) |const| |
  34. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`get_monitor_modification_time<class_Performance_method_get_monitor_modification_time>`\ (\ ) |
  36. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`has_custom_monitor<class_Performance_method_has_custom_monitor>`\ (\ id\: :ref:`StringName<class_StringName>`\ ) |
  38. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | |void| | :ref:`remove_custom_monitor<class_Performance_method_remove_custom_monitor>`\ (\ id\: :ref:`StringName<class_StringName>`\ ) |
  40. +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. .. rst-class:: classref-section-separator
  42. ----
  43. .. rst-class:: classref-descriptions-group
  44. Enumerations
  45. ------------
  46. .. _enum_Performance_Monitor:
  47. .. rst-class:: classref-enumeration
  48. enum **Monitor**: :ref:`🔗<enum_Performance_Monitor>`
  49. .. _class_Performance_constant_TIME_FPS:
  50. .. rst-class:: classref-enumeration-constant
  51. :ref:`Monitor<enum_Performance_Monitor>` **TIME_FPS** = ``0``
  52. 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.*
  53. .. _class_Performance_constant_TIME_PROCESS:
  54. .. rst-class:: classref-enumeration-constant
  55. :ref:`Monitor<enum_Performance_Monitor>` **TIME_PROCESS** = ``1``
  56. Time it took to complete one frame, in seconds. *Lower is better.*
  57. .. _class_Performance_constant_TIME_PHYSICS_PROCESS:
  58. .. rst-class:: classref-enumeration-constant
  59. :ref:`Monitor<enum_Performance_Monitor>` **TIME_PHYSICS_PROCESS** = ``2``
  60. Time it took to complete one physics frame, in seconds. *Lower is better.*
  61. .. _class_Performance_constant_TIME_NAVIGATION_PROCESS:
  62. .. rst-class:: classref-enumeration-constant
  63. :ref:`Monitor<enum_Performance_Monitor>` **TIME_NAVIGATION_PROCESS** = ``3``
  64. Time it took to complete one navigation step, in seconds. This includes navigation map updates as well as agent avoidance calculations. *Lower is better.*
  65. .. _class_Performance_constant_MEMORY_STATIC:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`Monitor<enum_Performance_Monitor>` **MEMORY_STATIC** = ``4``
  68. Static memory currently used, in bytes. Not available in release builds. *Lower is better.*
  69. .. _class_Performance_constant_MEMORY_STATIC_MAX:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`Monitor<enum_Performance_Monitor>` **MEMORY_STATIC_MAX** = ``5``
  72. Available static memory. Not available in release builds. *Lower is better.*
  73. .. _class_Performance_constant_MEMORY_MESSAGE_BUFFER_MAX:
  74. .. rst-class:: classref-enumeration-constant
  75. :ref:`Monitor<enum_Performance_Monitor>` **MEMORY_MESSAGE_BUFFER_MAX** = ``6``
  76. 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.*
  77. .. _class_Performance_constant_OBJECT_COUNT:
  78. .. rst-class:: classref-enumeration-constant
  79. :ref:`Monitor<enum_Performance_Monitor>` **OBJECT_COUNT** = ``7``
  80. Number of objects currently instantiated (including nodes). *Lower is better.*
  81. .. _class_Performance_constant_OBJECT_RESOURCE_COUNT:
  82. .. rst-class:: classref-enumeration-constant
  83. :ref:`Monitor<enum_Performance_Monitor>` **OBJECT_RESOURCE_COUNT** = ``8``
  84. Number of resources currently used. *Lower is better.*
  85. .. _class_Performance_constant_OBJECT_NODE_COUNT:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`Monitor<enum_Performance_Monitor>` **OBJECT_NODE_COUNT** = ``9``
  88. Number of nodes currently instantiated in the scene tree. This also includes the root node. *Lower is better.*
  89. .. _class_Performance_constant_OBJECT_ORPHAN_NODE_COUNT:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`Monitor<enum_Performance_Monitor>` **OBJECT_ORPHAN_NODE_COUNT** = ``10``
  92. Number of orphan nodes, i.e. nodes which are not parented to a node of the scene tree. *Lower is better.*\
  93. \ **Note:** This is only available in debug mode and will always return ``0`` when used in a project exported in release mode.
  94. .. _class_Performance_constant_RENDER_TOTAL_OBJECTS_IN_FRAME:
  95. .. rst-class:: classref-enumeration-constant
  96. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_TOTAL_OBJECTS_IN_FRAME** = ``11``
  97. 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.*
  98. .. _class_Performance_constant_RENDER_TOTAL_PRIMITIVES_IN_FRAME:
  99. .. rst-class:: classref-enumeration-constant
  100. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_TOTAL_PRIMITIVES_IN_FRAME** = ``12``
  101. 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.*
  102. .. _class_Performance_constant_RENDER_TOTAL_DRAW_CALLS_IN_FRAME:
  103. .. rst-class:: classref-enumeration-constant
  104. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_TOTAL_DRAW_CALLS_IN_FRAME** = ``13``
  105. 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.*
  106. .. _class_Performance_constant_RENDER_VIDEO_MEM_USED:
  107. .. rst-class:: classref-enumeration-constant
  108. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_VIDEO_MEM_USED** = ``14``
  109. 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 :ref:`RENDER_TEXTURE_MEM_USED<class_Performance_constant_RENDER_TEXTURE_MEM_USED>` and :ref:`RENDER_BUFFER_MEM_USED<class_Performance_constant_RENDER_BUFFER_MEM_USED>`. *Lower is better.*
  110. .. _class_Performance_constant_RENDER_TEXTURE_MEM_USED:
  111. .. rst-class:: classref-enumeration-constant
  112. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_TEXTURE_MEM_USED** = ``15``
  113. The amount of texture memory used (in bytes). *Lower is better.*
  114. .. _class_Performance_constant_RENDER_BUFFER_MEM_USED:
  115. .. rst-class:: classref-enumeration-constant
  116. :ref:`Monitor<enum_Performance_Monitor>` **RENDER_BUFFER_MEM_USED** = ``16``
  117. The amount of render buffer memory used (in bytes). *Lower is better.*
  118. .. _class_Performance_constant_PHYSICS_2D_ACTIVE_OBJECTS:
  119. .. rst-class:: classref-enumeration-constant
  120. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_2D_ACTIVE_OBJECTS** = ``17``
  121. Number of active :ref:`RigidBody2D<class_RigidBody2D>` nodes in the game. *Lower is better.*
  122. .. _class_Performance_constant_PHYSICS_2D_COLLISION_PAIRS:
  123. .. rst-class:: classref-enumeration-constant
  124. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_2D_COLLISION_PAIRS** = ``18``
  125. Number of collision pairs in the 2D physics engine. *Lower is better.*
  126. .. _class_Performance_constant_PHYSICS_2D_ISLAND_COUNT:
  127. .. rst-class:: classref-enumeration-constant
  128. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_2D_ISLAND_COUNT** = ``19``
  129. Number of islands in the 2D physics engine. *Lower is better.*
  130. .. _class_Performance_constant_PHYSICS_3D_ACTIVE_OBJECTS:
  131. .. rst-class:: classref-enumeration-constant
  132. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_3D_ACTIVE_OBJECTS** = ``20``
  133. Number of active :ref:`RigidBody3D<class_RigidBody3D>` and :ref:`VehicleBody3D<class_VehicleBody3D>` nodes in the game. *Lower is better.*
  134. .. _class_Performance_constant_PHYSICS_3D_COLLISION_PAIRS:
  135. .. rst-class:: classref-enumeration-constant
  136. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_3D_COLLISION_PAIRS** = ``21``
  137. Number of collision pairs in the 3D physics engine. *Lower is better.*
  138. .. _class_Performance_constant_PHYSICS_3D_ISLAND_COUNT:
  139. .. rst-class:: classref-enumeration-constant
  140. :ref:`Monitor<enum_Performance_Monitor>` **PHYSICS_3D_ISLAND_COUNT** = ``22``
  141. Number of islands in the 3D physics engine. *Lower is better.*
  142. .. _class_Performance_constant_AUDIO_OUTPUT_LATENCY:
  143. .. rst-class:: classref-enumeration-constant
  144. :ref:`Monitor<enum_Performance_Monitor>` **AUDIO_OUTPUT_LATENCY** = ``23``
  145. 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.
  146. .. _class_Performance_constant_NAVIGATION_ACTIVE_MAPS:
  147. .. rst-class:: classref-enumeration-constant
  148. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_ACTIVE_MAPS** = ``24``
  149. Number of active navigation maps in :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`. This also includes the two empty default navigation maps created by World2D and World3D.
  150. .. _class_Performance_constant_NAVIGATION_REGION_COUNT:
  151. .. rst-class:: classref-enumeration-constant
  152. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_REGION_COUNT** = ``25``
  153. Number of active navigation regions in :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`.
  154. .. _class_Performance_constant_NAVIGATION_AGENT_COUNT:
  155. .. rst-class:: classref-enumeration-constant
  156. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_AGENT_COUNT** = ``26``
  157. Number of active navigation agents processing avoidance in :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`.
  158. .. _class_Performance_constant_NAVIGATION_LINK_COUNT:
  159. .. rst-class:: classref-enumeration-constant
  160. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_LINK_COUNT** = ``27``
  161. Number of active navigation links in :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`.
  162. .. _class_Performance_constant_NAVIGATION_POLYGON_COUNT:
  163. .. rst-class:: classref-enumeration-constant
  164. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_POLYGON_COUNT** = ``28``
  165. Number of navigation mesh polygons in :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`.
  166. .. _class_Performance_constant_NAVIGATION_EDGE_COUNT:
  167. .. rst-class:: classref-enumeration-constant
  168. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_EDGE_COUNT** = ``29``
  169. Number of navigation mesh polygon edges in :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`.
  170. .. _class_Performance_constant_NAVIGATION_EDGE_MERGE_COUNT:
  171. .. rst-class:: classref-enumeration-constant
  172. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_EDGE_MERGE_COUNT** = ``30``
  173. Number of navigation mesh polygon edges that were merged due to edge key overlap in :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`.
  174. .. _class_Performance_constant_NAVIGATION_EDGE_CONNECTION_COUNT:
  175. .. rst-class:: classref-enumeration-constant
  176. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_EDGE_CONNECTION_COUNT** = ``31``
  177. Number of polygon edges that are considered connected by edge proximity :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`.
  178. .. _class_Performance_constant_NAVIGATION_EDGE_FREE_COUNT:
  179. .. rst-class:: classref-enumeration-constant
  180. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_EDGE_FREE_COUNT** = ``32``
  181. Number of navigation mesh polygon edges that could not be merged in :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`. The edges still may be connected by edge proximity or with links.
  182. .. _class_Performance_constant_NAVIGATION_OBSTACLE_COUNT:
  183. .. rst-class:: classref-enumeration-constant
  184. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_OBSTACLE_COUNT** = ``33``
  185. Number of active navigation obstacles in the :ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>`.
  186. .. _class_Performance_constant_PIPELINE_COMPILATIONS_CANVAS:
  187. .. rst-class:: classref-enumeration-constant
  188. :ref:`Monitor<enum_Performance_Monitor>` **PIPELINE_COMPILATIONS_CANVAS** = ``34``
  189. Number of pipeline compilations that were triggered by the 2D canvas renderer.
  190. .. _class_Performance_constant_PIPELINE_COMPILATIONS_MESH:
  191. .. rst-class:: classref-enumeration-constant
  192. :ref:`Monitor<enum_Performance_Monitor>` **PIPELINE_COMPILATIONS_MESH** = ``35``
  193. 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.
  194. .. _class_Performance_constant_PIPELINE_COMPILATIONS_SURFACE:
  195. .. rst-class:: classref-enumeration-constant
  196. :ref:`Monitor<enum_Performance_Monitor>` **PIPELINE_COMPILATIONS_SURFACE** = ``36``
  197. 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.
  198. .. _class_Performance_constant_PIPELINE_COMPILATIONS_DRAW:
  199. .. rst-class:: classref-enumeration-constant
  200. :ref:`Monitor<enum_Performance_Monitor>` **PIPELINE_COMPILATIONS_DRAW** = ``37``
  201. 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.
  202. .. _class_Performance_constant_PIPELINE_COMPILATIONS_SPECIALIZATION:
  203. .. rst-class:: classref-enumeration-constant
  204. :ref:`Monitor<enum_Performance_Monitor>` **PIPELINE_COMPILATIONS_SPECIALIZATION** = ``38``
  205. 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.
  206. .. _class_Performance_constant_NAVIGATION_2D_ACTIVE_MAPS:
  207. .. rst-class:: classref-enumeration-constant
  208. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_ACTIVE_MAPS** = ``39``
  209. Number of active navigation maps in the :ref:`NavigationServer2D<class_NavigationServer2D>`. This also includes the two empty default navigation maps created by World2D.
  210. .. _class_Performance_constant_NAVIGATION_2D_REGION_COUNT:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_REGION_COUNT** = ``40``
  213. Number of active navigation regions in the :ref:`NavigationServer2D<class_NavigationServer2D>`.
  214. .. _class_Performance_constant_NAVIGATION_2D_AGENT_COUNT:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_AGENT_COUNT** = ``41``
  217. Number of active navigation agents processing avoidance in the :ref:`NavigationServer2D<class_NavigationServer2D>`.
  218. .. _class_Performance_constant_NAVIGATION_2D_LINK_COUNT:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_LINK_COUNT** = ``42``
  221. Number of active navigation links in the :ref:`NavigationServer2D<class_NavigationServer2D>`.
  222. .. _class_Performance_constant_NAVIGATION_2D_POLYGON_COUNT:
  223. .. rst-class:: classref-enumeration-constant
  224. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_POLYGON_COUNT** = ``43``
  225. Number of navigation mesh polygons in the :ref:`NavigationServer2D<class_NavigationServer2D>`.
  226. .. _class_Performance_constant_NAVIGATION_2D_EDGE_COUNT:
  227. .. rst-class:: classref-enumeration-constant
  228. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_EDGE_COUNT** = ``44``
  229. Number of navigation mesh polygon edges in the :ref:`NavigationServer2D<class_NavigationServer2D>`.
  230. .. _class_Performance_constant_NAVIGATION_2D_EDGE_MERGE_COUNT:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_EDGE_MERGE_COUNT** = ``45``
  233. Number of navigation mesh polygon edges that were merged due to edge key overlap in the :ref:`NavigationServer2D<class_NavigationServer2D>`.
  234. .. _class_Performance_constant_NAVIGATION_2D_EDGE_CONNECTION_COUNT:
  235. .. rst-class:: classref-enumeration-constant
  236. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_EDGE_CONNECTION_COUNT** = ``46``
  237. Number of polygon edges that are considered connected by edge proximity :ref:`NavigationServer2D<class_NavigationServer2D>`.
  238. .. _class_Performance_constant_NAVIGATION_2D_EDGE_FREE_COUNT:
  239. .. rst-class:: classref-enumeration-constant
  240. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_EDGE_FREE_COUNT** = ``47``
  241. Number of navigation mesh polygon edges that could not be merged in the :ref:`NavigationServer2D<class_NavigationServer2D>`. The edges still may be connected by edge proximity or with links.
  242. .. _class_Performance_constant_NAVIGATION_2D_OBSTACLE_COUNT:
  243. .. rst-class:: classref-enumeration-constant
  244. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_2D_OBSTACLE_COUNT** = ``48``
  245. Number of active navigation obstacles in the :ref:`NavigationServer2D<class_NavigationServer2D>`.
  246. .. _class_Performance_constant_NAVIGATION_3D_ACTIVE_MAPS:
  247. .. rst-class:: classref-enumeration-constant
  248. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_ACTIVE_MAPS** = ``49``
  249. Number of active navigation maps in the :ref:`NavigationServer3D<class_NavigationServer3D>`. This also includes the two empty default navigation maps created by World3D.
  250. .. _class_Performance_constant_NAVIGATION_3D_REGION_COUNT:
  251. .. rst-class:: classref-enumeration-constant
  252. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_REGION_COUNT** = ``50``
  253. Number of active navigation regions in the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  254. .. _class_Performance_constant_NAVIGATION_3D_AGENT_COUNT:
  255. .. rst-class:: classref-enumeration-constant
  256. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_AGENT_COUNT** = ``51``
  257. Number of active navigation agents processing avoidance in the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  258. .. _class_Performance_constant_NAVIGATION_3D_LINK_COUNT:
  259. .. rst-class:: classref-enumeration-constant
  260. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_LINK_COUNT** = ``52``
  261. Number of active navigation links in the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  262. .. _class_Performance_constant_NAVIGATION_3D_POLYGON_COUNT:
  263. .. rst-class:: classref-enumeration-constant
  264. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_POLYGON_COUNT** = ``53``
  265. Number of navigation mesh polygons in the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  266. .. _class_Performance_constant_NAVIGATION_3D_EDGE_COUNT:
  267. .. rst-class:: classref-enumeration-constant
  268. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_EDGE_COUNT** = ``54``
  269. Number of navigation mesh polygon edges in the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  270. .. _class_Performance_constant_NAVIGATION_3D_EDGE_MERGE_COUNT:
  271. .. rst-class:: classref-enumeration-constant
  272. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_EDGE_MERGE_COUNT** = ``55``
  273. Number of navigation mesh polygon edges that were merged due to edge key overlap in the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  274. .. _class_Performance_constant_NAVIGATION_3D_EDGE_CONNECTION_COUNT:
  275. .. rst-class:: classref-enumeration-constant
  276. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_EDGE_CONNECTION_COUNT** = ``56``
  277. Number of polygon edges that are considered connected by edge proximity :ref:`NavigationServer3D<class_NavigationServer3D>`.
  278. .. _class_Performance_constant_NAVIGATION_3D_EDGE_FREE_COUNT:
  279. .. rst-class:: classref-enumeration-constant
  280. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_EDGE_FREE_COUNT** = ``57``
  281. Number of navigation mesh polygon edges that could not be merged in the :ref:`NavigationServer3D<class_NavigationServer3D>`. The edges still may be connected by edge proximity or with links.
  282. .. _class_Performance_constant_NAVIGATION_3D_OBSTACLE_COUNT:
  283. .. rst-class:: classref-enumeration-constant
  284. :ref:`Monitor<enum_Performance_Monitor>` **NAVIGATION_3D_OBSTACLE_COUNT** = ``58``
  285. Number of active navigation obstacles in the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  286. .. _class_Performance_constant_MONITOR_MAX:
  287. .. rst-class:: classref-enumeration-constant
  288. :ref:`Monitor<enum_Performance_Monitor>` **MONITOR_MAX** = ``59``
  289. Represents the size of the :ref:`Monitor<enum_Performance_Monitor>` enum.
  290. .. rst-class:: classref-item-separator
  291. ----
  292. .. _enum_Performance_MonitorType:
  293. .. rst-class:: classref-enumeration
  294. enum **MonitorType**: :ref:`🔗<enum_Performance_MonitorType>`
  295. .. _class_Performance_constant_MONITOR_TYPE_QUANTITY:
  296. .. rst-class:: classref-enumeration-constant
  297. :ref:`MonitorType<enum_Performance_MonitorType>` **MONITOR_TYPE_QUANTITY** = ``0``
  298. Monitor output is formatted as an integer value.
  299. .. _class_Performance_constant_MONITOR_TYPE_MEMORY:
  300. .. rst-class:: classref-enumeration-constant
  301. :ref:`MonitorType<enum_Performance_MonitorType>` **MONITOR_TYPE_MEMORY** = ``1``
  302. Monitor output is formatted as computer memory. Submitted values should represent a number of bytes.
  303. .. _class_Performance_constant_MONITOR_TYPE_TIME:
  304. .. rst-class:: classref-enumeration-constant
  305. :ref:`MonitorType<enum_Performance_MonitorType>` **MONITOR_TYPE_TIME** = ``2``
  306. Monitor output is formatted as time in milliseconds. Submitted values should represent a time in seconds (not milliseconds).
  307. .. _class_Performance_constant_MONITOR_TYPE_PERCENTAGE:
  308. .. rst-class:: classref-enumeration-constant
  309. :ref:`MonitorType<enum_Performance_MonitorType>` **MONITOR_TYPE_PERCENTAGE** = ``3``
  310. Monitor output is formatted as a percentage. Submitted values should represent a fractional value rather than the percentage directly, e.g. ``0.5`` for ``50.00%``.
  311. .. rst-class:: classref-section-separator
  312. ----
  313. .. rst-class:: classref-descriptions-group
  314. Method Descriptions
  315. -------------------
  316. .. _class_Performance_method_add_custom_monitor:
  317. .. rst-class:: classref-method
  318. |void| **add_custom_monitor**\ (\ id\: :ref:`StringName<class_StringName>`, callable\: :ref:`Callable<class_Callable>`, arguments\: :ref:`Array<class_Array>` = [], type\: :ref:`MonitorType<enum_Performance_MonitorType>` = 0\ ) :ref:`🔗<class_Performance_method_add_custom_monitor>`
  319. 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.
  320. .. tabs::
  321. .. code-tab:: gdscript
  322. func _ready():
  323. var monitor_value = Callable(self, "get_monitor_value")
  324. # Adds monitor with name "MyName" to category "MyCategory".
  325. Performance.add_custom_monitor("MyCategory/MyMonitor", monitor_value)
  326. # Adds monitor with name "MyName" to category "Custom".
  327. # Note: "MyCategory/MyMonitor" and "MyMonitor" have same name but different IDs, so the code is valid.
  328. Performance.add_custom_monitor("MyMonitor", monitor_value)
  329. # Adds monitor with name "MyName" to category "Custom".
  330. # Note: "MyMonitor" and "Custom/MyMonitor" have same name and same category but different IDs, so the code is valid.
  331. Performance.add_custom_monitor("Custom/MyMonitor", monitor_value)
  332. # Adds monitor with name "MyCategoryOne/MyCategoryTwo/MyMonitor" to category "Custom".
  333. Performance.add_custom_monitor("MyCategoryOne/MyCategoryTwo/MyMonitor", monitor_value)
  334. func get_monitor_value():
  335. return randi() % 25
  336. .. code-tab:: csharp
  337. public override void _Ready()
  338. {
  339. var monitorValue = new Callable(this, MethodName.GetMonitorValue);
  340. // Adds monitor with name "MyName" to category "MyCategory".
  341. Performance.AddCustomMonitor("MyCategory/MyMonitor", monitorValue);
  342. // Adds monitor with name "MyName" to category "Custom".
  343. // Note: "MyCategory/MyMonitor" and "MyMonitor" have same name but different ids so the code is valid.
  344. Performance.AddCustomMonitor("MyMonitor", monitorValue);
  345. // Adds monitor with name "MyName" to category "Custom".
  346. // Note: "MyMonitor" and "Custom/MyMonitor" have same name and same category but different ids so the code is valid.
  347. Performance.AddCustomMonitor("Custom/MyMonitor", monitorValue);
  348. // Adds monitor with name "MyCategoryOne/MyCategoryTwo/MyMonitor" to category "Custom".
  349. Performance.AddCustomMonitor("MyCategoryOne/MyCategoryTwo/MyMonitor", monitorValue);
  350. }
  351. public int GetMonitorValue()
  352. {
  353. return GD.Randi() % 25;
  354. }
  355. 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.
  356. Callables are called with arguments supplied in argument array.
  357. .. rst-class:: classref-item-separator
  358. ----
  359. .. _class_Performance_method_get_custom_monitor:
  360. .. rst-class:: classref-method
  361. :ref:`Variant<class_Variant>` **get_custom_monitor**\ (\ id\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Performance_method_get_custom_monitor>`
  362. Returns the value of custom monitor with given ``id``. The callable is called to get the value of custom monitor. See also :ref:`has_custom_monitor()<class_Performance_method_has_custom_monitor>`. Prints an error if the given ``id`` is absent.
  363. .. rst-class:: classref-item-separator
  364. ----
  365. .. _class_Performance_method_get_custom_monitor_names:
  366. .. rst-class:: classref-method
  367. :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] **get_custom_monitor_names**\ (\ ) :ref:`🔗<class_Performance_method_get_custom_monitor_names>`
  368. Returns the names of active custom monitors in an :ref:`Array<class_Array>`.
  369. .. rst-class:: classref-item-separator
  370. ----
  371. .. _class_Performance_method_get_custom_monitor_types:
  372. .. rst-class:: classref-method
  373. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_custom_monitor_types**\ (\ ) :ref:`🔗<class_Performance_method_get_custom_monitor_types>`
  374. Returns the :ref:`MonitorType<enum_Performance_MonitorType>` values of active custom monitors in an :ref:`Array<class_Array>`.
  375. .. rst-class:: classref-item-separator
  376. ----
  377. .. _class_Performance_method_get_monitor:
  378. .. rst-class:: classref-method
  379. :ref:`float<class_float>` **get_monitor**\ (\ monitor\: :ref:`Monitor<enum_Performance_Monitor>`\ ) |const| :ref:`🔗<class_Performance_method_get_monitor>`
  380. Returns the value of one of the available built-in monitors. You should provide one of the :ref:`Monitor<enum_Performance_Monitor>` constants as the argument, like this:
  381. .. tabs::
  382. .. code-tab:: gdscript
  383. print(Performance.get_monitor(Performance.TIME_FPS)) # Prints the FPS to the console.
  384. .. code-tab:: csharp
  385. GD.Print(Performance.GetMonitor(Performance.Monitor.TimeFps)); // Prints the FPS to the console.
  386. See :ref:`get_custom_monitor()<class_Performance_method_get_custom_monitor>` to query custom performance monitors' values.
  387. .. rst-class:: classref-item-separator
  388. ----
  389. .. _class_Performance_method_get_monitor_modification_time:
  390. .. rst-class:: classref-method
  391. :ref:`int<class_int>` **get_monitor_modification_time**\ (\ ) :ref:`🔗<class_Performance_method_get_monitor_modification_time>`
  392. Returns the last tick in which custom monitor was added/removed (in microseconds since the engine started). This is set to :ref:`Time.get_ticks_usec()<class_Time_method_get_ticks_usec>` when the monitor is updated.
  393. .. rst-class:: classref-item-separator
  394. ----
  395. .. _class_Performance_method_has_custom_monitor:
  396. .. rst-class:: classref-method
  397. :ref:`bool<class_bool>` **has_custom_monitor**\ (\ id\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Performance_method_has_custom_monitor>`
  398. Returns ``true`` if custom monitor with the given ``id`` is present, ``false`` otherwise.
  399. .. rst-class:: classref-item-separator
  400. ----
  401. .. _class_Performance_method_remove_custom_monitor:
  402. .. rst-class:: classref-method
  403. |void| **remove_custom_monitor**\ (\ id\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Performance_method_remove_custom_monitor>`
  404. Removes the custom monitor with given ``id``. Prints an error if the given ``id`` is already absent.
  405. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  406. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  407. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  408. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  409. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  410. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  411. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  412. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  413. .. |void| replace:: :abbr:`void (No return value.)`