class_performance.rst 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Performance.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Performance:
  5. Performance
  6. ===========
  7. **Inherits:** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Exposes performance related data.
  12. Member Functions
  13. ----------------
  14. +----------------------------+---------------------------------------------------------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`get_monitor<class_Performance_get_monitor>` **(** :ref:`int<class_int>` monitor **)** const |
  16. +----------------------------+---------------------------------------------------------------------------------------------------+
  17. Enums
  18. -----
  19. .. _enum_Performance_Monitor:
  20. enum **Monitor**
  21. - **TIME_FPS** = **0** --- Frames per second.
  22. - **TIME_PROCESS** = **1** --- Time it took to complete one frame.
  23. - **TIME_PHYSICS_PROCESS** = **2** --- Time it took to complete one physics frame.
  24. - **MEMORY_STATIC** = **3** --- Static memory currently used, in bytes. Not available in release builds.
  25. - **MEMORY_DYNAMIC** = **4** --- Dynamic memory currently used, in bytes. Not available in release builds.
  26. - **MEMORY_STATIC_MAX** = **5** --- Available static memory. Not available in release builds.
  27. - **MEMORY_DYNAMIC_MAX** = **6** --- Available dynamic memory. Not available in release builds.
  28. - **MEMORY_MESSAGE_BUFFER_MAX** = **7** --- Largest amount of memory the message queue buffer has used, in bytes. The message queue is used for deferred functions calls and notifications.
  29. - **OBJECT_COUNT** = **8** --- Number of objects currently instanced (including nodes).
  30. - **OBJECT_RESOURCE_COUNT** = **9** --- Number of resources currently used.
  31. - **OBJECT_NODE_COUNT** = **10** --- Number of nodes currently instanced. This also includes the root node, as well as any nodes not in the scene tree.
  32. - **RENDER_OBJECTS_IN_FRAME** = **11** --- 3D objects drawn per frame.
  33. - **RENDER_VERTICES_IN_FRAME** = **12** --- Vertices drawn per frame. 3D only.
  34. - **RENDER_MATERIAL_CHANGES_IN_FRAME** = **13** --- Material changes per frame. 3D only
  35. - **RENDER_SHADER_CHANGES_IN_FRAME** = **14** --- Shader changes per frame. 3D only.
  36. - **RENDER_SURFACE_CHANGES_IN_FRAME** = **15** --- Render surface changes per frame. 3D only.
  37. - **RENDER_DRAW_CALLS_IN_FRAME** = **16** --- Draw calls per frame. 3D only.
  38. - **RENDER_VIDEO_MEM_USED** = **17** --- Video memory used. Includes both texture and vertex memory.
  39. - **RENDER_TEXTURE_MEM_USED** = **18** --- Texture memory used.
  40. - **RENDER_VERTEX_MEM_USED** = **19** --- Vertex memory used.
  41. - **RENDER_USAGE_VIDEO_MEM_TOTAL** = **20**
  42. - **PHYSICS_2D_ACTIVE_OBJECTS** = **21** --- Number of active :ref:`RigidBody2D<class_rigidbody2d>` nodes in the game.
  43. - **PHYSICS_2D_COLLISION_PAIRS** = **22** --- Number of collision pairs in the 2D physics engine.
  44. - **PHYSICS_2D_ISLAND_COUNT** = **23** --- Number of islands in the 2D physics engine.
  45. - **PHYSICS_3D_ACTIVE_OBJECTS** = **24** --- Number of active :ref:`RigidBody<class_rigidbody>` and :ref:`VehicleBody<class_vehiclebody>` nodes in the game.
  46. - **PHYSICS_3D_COLLISION_PAIRS** = **25** --- Number of collision pairs in the 3D physics engine.
  47. - **PHYSICS_3D_ISLAND_COUNT** = **26** --- Number of islands in the 3D physics engine.
  48. - **MONITOR_MAX** = **27**
  49. Description
  50. -----------
  51. 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_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.
  52. Many of these monitors are not updated in real-time, so there may be a short delay between changes.
  53. Member Function Description
  54. ---------------------------
  55. .. _class_Performance_get_monitor:
  56. - :ref:`float<class_float>` **get_monitor** **(** :ref:`int<class_int>` monitor **)** const
  57. Returns the value of one of the available monitors. You should provide one of this class's constants as the argument, like this:
  58. ::
  59. print(Performance.get_monitor(Performance.TIME_FPS)) # Prints the FPS to the console