Performance.xml 5.0 KB

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