Performance.xml 5.8 KB

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