2
0

debugger_panel.rst 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. .. _doc_debugger_panel:
  2. Debugger panel
  3. ==============
  4. Many of Godot's debugging tools, including the debugger, can be found in the
  5. debugger panel at the bottom of the screen. Click on **Debugger** to open it.
  6. .. image:: img/overview_debugger.webp
  7. The debugger panel is split into several tabs, each focusing on a specific task.
  8. Debugger
  9. --------
  10. The Debugger tab opens automatically when the GDScript compiler reaches
  11. a breakpoint in your code.
  12. It gives you a `stack trace <https://en.wikipedia.org/wiki/Stack_trace>`__,
  13. information about the state of the object, and buttons to control
  14. the program's execution.
  15. You can use the buttons in the top-right corner to:
  16. - Skip all breakpoints. That way, you can save breakpoints for future
  17. debugging sessions.
  18. - Copy the current error message.
  19. - **Step Into** the code. This button takes you to the next line of code,
  20. and if it's a function, it steps line-by-line through the function.
  21. - **Step Over** the code. This button goes to the next line of code,
  22. but it doesn't step line-by-line through functions.
  23. - **Break**. This button pauses the game's execution.
  24. - **Continue**. This button resumes the game after a breakpoint or pause.
  25. .. warning::
  26. Breakpoints won't break on code if it's
  27. :ref:`running in a thread <doc_using_multiple_threads>`.
  28. This is a current limitation of the GDScript debugger.
  29. Errors
  30. ------
  31. This is where error and warning messages are printed while running the game.
  32. You can disable specific warnings in **Project Settings > Debug > GDScript**.
  33. Profiler
  34. --------
  35. The profiler is used to see what code is running while your project is in use,
  36. and how that effects performance.
  37. .. seealso::
  38. A detailed explanation of how to use the profiler can be found in the
  39. dedicated :ref:`doc_the_profiler` page.
  40. Visual Profiler
  41. ---------------
  42. The Visual Profiler can be used to monitor what is taking the most time when
  43. rendering a frame on the CPU and GPU respectively. This allows tracking sources
  44. of potential CPU and GPU bottlenecks caused by rendering.
  45. .. warning::
  46. The Visual Profiler only measures CPU time taken for rendering tasks, such
  47. as performing draw calls. The Visual Profiler does **not** include CPU time
  48. taken for other tasks such as scripting and physics. Use the standard
  49. Profiler tab to track non-rendering-related CPU tasks.
  50. To use the visual profiler, run the project, switch to the **Visual Profiler**
  51. tab within the Debugger bottom panel, then click **Start**:
  52. .. figure:: img/debugger_visual_profiler_results.webp
  53. :alt: Visual Profiler tab after clicking Start, waiting for a few seconds, then clicking Stop
  54. Visual Profiler tab after clicking **Start**, waiting for a few seconds, then clicking **Stop**
  55. You will see categories and results appearing as the profiler is running. Graph
  56. lines also appear, with the left side being a CPU framegraph and the right side
  57. being a GPU framegraph.
  58. Click **Stop** to finish profiling, which will keep the results visible but
  59. frozen in place. Results remain visible after stopping the running project, but
  60. not after exiting the editor.
  61. Click on result categories on the left to highlight them in the CPU and GPU
  62. graphs on the right. You can also click on the graph to move the cursor to a
  63. specific frame number and highlight the selected data type in the result
  64. categories on the left.
  65. You can switch the result display between a time value (in milliseconds per
  66. frame) or a percentage of the target frametime (which is currently hardcoded to
  67. 16.67 milliseconds, or 60 FPS).
  68. If framerate spikes occur during profiling, this can cause the graph to be
  69. poorly scaled. Disable **Fit to Frame** so that the graph will zoom onto the 60
  70. FPS+ portion.
  71. .. note::
  72. Remember that Visual Profiler results can vary **heavily** based on
  73. viewport resolution, which is determined by the window size if using the
  74. ``disabled`` or ``canvas_items`` :ref:`stretch modes
  75. <doc_multiple_resolutions>`.
  76. When comparing results across different runs, make sure to use the same
  77. viewport size for all runs.
  78. Visual Profiler is supported when using any rendering method (Forward+, Mobile
  79. or Compatibility), but the reported categories will vary depending on the
  80. current rendering method as well as the enabled graphics features. For example,
  81. when using Forward+, a simple 2D scene with shadow-casting lights will result in
  82. the following categories appearing:
  83. .. figure:: img/debugger_visual_profiler_2d_example.webp
  84. :alt: Example results from a 2D scene in the Visual Profiler
  85. Example results from a 2D scene in the Visual Profiler
  86. To give another example with Forward+, a 3D scene with shadow-casting lights and
  87. various effects enabled will result in the following categories enabled:
  88. .. figure:: img/debugger_visual_profiler_3d_example.webp
  89. :alt: Example results from a 3D scene in the Visual Profiler
  90. Example results from a 3D scene in the Visual Profiler
  91. Notice how in the 3D example, several of the categories have **(Parallel)**
  92. appended to their name. This hints that multiple tasks are being performed in
  93. parallel on the GPU. This generally means that disabling only one of the
  94. features involved won't improve performance as much as anticipated, as the other
  95. task still needs to be performed sequentially.
  96. Network Profiler
  97. ----------------
  98. The Network Profiler contains a list of all the nodes that communicate over the
  99. multiplayer API and, for each one, some counters on the amount of incoming and
  100. outgoing network interactions. It also features a bandwidth meter that displays
  101. the total bandwidth usage at any given moment.
  102. .. note::
  103. The bandwidth meter does **not** take the :ref:`doc_high_level_multiplayer`
  104. API's own compression system into account. This means that changing the
  105. compression algorithm used will not change the metrics reported by the
  106. bandwidth meter.
  107. Monitors
  108. --------
  109. The monitors are graphs of several aspects of the game while its running such as
  110. FPS, memory usage, how many nodes are in a scene and more. All monitors keep
  111. track of stats automatically, so even if one monitor isn't open while the game
  112. is running, you can open it later and see how the values changed.
  113. .. seealso::
  114. In addition to the default performance monitors, you can also create
  115. :ref:`custom performance monitors <doc_custom_performance_monitors>`
  116. to track arbitrary values in your project.
  117. Video RAM
  118. ---------
  119. The **Video RAM** tab shows the video RAM usage of the game while it is running.
  120. It provides a list of every resource using video RAM by resource path, the type
  121. of resource it is, what format it is in, and how much Video RAM that resource is
  122. using. There is also a total video RAM usage number at the top right of the panel.
  123. .. image:: img/video_ram.png
  124. Misc
  125. ----
  126. The **Misc** tab contains tools to identify the control nodes you are clicking
  127. at runtime:
  128. - **Clicked Control** tells you where the clicked node is in the scene tree.
  129. - **Clicked Control Type** tells you the type of the node you clicked is.