Performance.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Performance" inherits="Object" version="3.4">
  3. <brief_description>
  4. Exposes performance-related data.
  5. </brief_description>
  6. <description>
  7. 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 [b]Monitor[/b] tab in the editor's [b]Debugger[/b] panel. By using the [method get_monitor] method of this class, you can access this data from your code.
  8. [b]Note:[/b] A few of these monitors are only available in debug mode and will always return 0 when used in a release build.
  9. [b]Note:[/b] Many of these monitors are not updated in real-time, so there may be a short delay between changes.
  10. </description>
  11. <tutorials>
  12. </tutorials>
  13. <methods>
  14. <method name="get_monitor" qualifiers="const">
  15. <return type="float">
  16. </return>
  17. <argument index="0" name="monitor" type="int" enum="Performance.Monitor">
  18. </argument>
  19. <description>
  20. Returns the value of one of the available monitors. You should provide one of the [enum Monitor] constants as the argument, like this:
  21. [codeblock]
  22. print(Performance.get_monitor(Performance.TIME_FPS)) # Prints the FPS to the console
  23. [/codeblock]
  24. </description>
  25. </method>
  26. </methods>
  27. <constants>
  28. <constant name="TIME_FPS" value="0" enum="Monitor">
  29. Number of frames per second.
  30. </constant>
  31. <constant name="TIME_PROCESS" value="1" enum="Monitor">
  32. Time it took to complete one frame, in seconds.
  33. </constant>
  34. <constant name="TIME_PHYSICS_PROCESS" value="2" enum="Monitor">
  35. Time it took to complete one physics frame, in seconds.
  36. </constant>
  37. <constant name="MEMORY_STATIC" value="3" enum="Monitor">
  38. Static memory currently used, in bytes. Not available in release builds.
  39. </constant>
  40. <constant name="MEMORY_DYNAMIC" value="4" enum="Monitor">
  41. Dynamic memory currently used, in bytes. Not available in release builds.
  42. </constant>
  43. <constant name="MEMORY_STATIC_MAX" value="5" enum="Monitor">
  44. Available static memory. Not available in release builds.
  45. </constant>
  46. <constant name="MEMORY_DYNAMIC_MAX" value="6" enum="Monitor">
  47. Available dynamic memory. Not available in release builds.
  48. </constant>
  49. <constant name="MEMORY_MESSAGE_BUFFER_MAX" value="7" enum="Monitor">
  50. Largest amount of memory the message queue buffer has used, in bytes. The message queue is used for deferred functions calls and notifications.
  51. </constant>
  52. <constant name="OBJECT_COUNT" value="8" enum="Monitor">
  53. Number of objects currently instanced (including nodes).
  54. </constant>
  55. <constant name="OBJECT_RESOURCE_COUNT" value="9" enum="Monitor">
  56. Number of resources currently used.
  57. </constant>
  58. <constant name="OBJECT_NODE_COUNT" value="10" enum="Monitor">
  59. Number of nodes currently instanced in the scene tree. This also includes the root node.
  60. </constant>
  61. <constant name="OBJECT_ORPHAN_NODE_COUNT" value="11" enum="Monitor">
  62. Number of orphan nodes, i.e. nodes which are not parented to a node of the scene tree.
  63. </constant>
  64. <constant name="RENDER_OBJECTS_IN_FRAME" value="12" enum="Monitor">
  65. 3D objects drawn per frame.
  66. </constant>
  67. <constant name="RENDER_VERTICES_IN_FRAME" value="13" enum="Monitor">
  68. Vertices drawn per frame. 3D only.
  69. </constant>
  70. <constant name="RENDER_MATERIAL_CHANGES_IN_FRAME" value="14" enum="Monitor">
  71. Material changes per frame. 3D only.
  72. </constant>
  73. <constant name="RENDER_SHADER_CHANGES_IN_FRAME" value="15" enum="Monitor">
  74. Shader changes per frame. 3D only.
  75. </constant>
  76. <constant name="RENDER_SURFACE_CHANGES_IN_FRAME" value="16" enum="Monitor">
  77. Render surface changes per frame. 3D only.
  78. </constant>
  79. <constant name="RENDER_DRAW_CALLS_IN_FRAME" value="17" enum="Monitor">
  80. Draw calls per frame. 3D only.
  81. </constant>
  82. <constant name="RENDER_2D_ITEMS_IN_FRAME" value="18" enum="Monitor">
  83. Items or joined items drawn per frame.
  84. </constant>
  85. <constant name="RENDER_2D_DRAW_CALLS_IN_FRAME" value="19" enum="Monitor">
  86. Draw calls per frame.
  87. </constant>
  88. <constant name="RENDER_VIDEO_MEM_USED" value="20" enum="Monitor">
  89. The amount of video memory used, i.e. texture and vertex memory combined.
  90. </constant>
  91. <constant name="RENDER_TEXTURE_MEM_USED" value="21" enum="Monitor">
  92. The amount of texture memory used.
  93. </constant>
  94. <constant name="RENDER_VERTEX_MEM_USED" value="22" enum="Monitor">
  95. The amount of vertex memory used.
  96. </constant>
  97. <constant name="RENDER_USAGE_VIDEO_MEM_TOTAL" value="23" enum="Monitor">
  98. Unimplemented in the GLES2 and GLES3 rendering backends, always returns 0.
  99. </constant>
  100. <constant name="PHYSICS_2D_ACTIVE_OBJECTS" value="24" enum="Monitor">
  101. Number of active [RigidBody2D] nodes in the game.
  102. </constant>
  103. <constant name="PHYSICS_2D_COLLISION_PAIRS" value="25" enum="Monitor">
  104. Number of collision pairs in the 2D physics engine.
  105. </constant>
  106. <constant name="PHYSICS_2D_ISLAND_COUNT" value="26" enum="Monitor">
  107. Number of islands in the 2D physics engine.
  108. </constant>
  109. <constant name="PHYSICS_3D_ACTIVE_OBJECTS" value="27" enum="Monitor">
  110. Number of active [RigidBody] and [VehicleBody] nodes in the game.
  111. </constant>
  112. <constant name="PHYSICS_3D_COLLISION_PAIRS" value="28" enum="Monitor">
  113. Number of collision pairs in the 3D physics engine.
  114. </constant>
  115. <constant name="PHYSICS_3D_ISLAND_COUNT" value="29" enum="Monitor">
  116. Number of islands in the 3D physics engine.
  117. </constant>
  118. <constant name="AUDIO_OUTPUT_LATENCY" value="30" enum="Monitor">
  119. Output latency of the [AudioServer].
  120. </constant>
  121. <constant name="MONITOR_MAX" value="31" enum="Monitor">
  122. Represents the size of the [enum Monitor] enum.
  123. </constant>
  124. </constants>
  125. </class>