class_performance.rst 32 KB

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