using_cpp_profilers.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. .. _doc_using_cpp_profilers:
  2. Using C++ profilers
  3. ===================
  4. To optimize Godot's performance, you need to know what to optimize first.
  5. To this end, profilers are useful tools.
  6. .. note::
  7. There is a :ref:`built-in GDScript profiler <doc_the_profiler>` in the editor,
  8. but using C++ profiler may be useful in cases where the GDScript profiler
  9. is not accurate enough or is missing information due to bugs in the profiler.
  10. There are two main types of profilers: sampling profilers and tracing profilers.
  11. Sampling profilers periodically interrupt the running program and take a "sample",
  12. which records which functions are running. Using this information, the profiler
  13. estimates which functions the program spent the most time in.
  14. Tracing profilers work by recording application-specific events (such as the
  15. start and end of a single frame), producing a log called a "trace". The profiler
  16. can use the trace to produce a graph showing an accurate high-level timeline of
  17. what happened. However, any code that is not explicitly instrumented will not
  18. appear in a tracing profiler's timeline!
  19. Godot supports both sampling profilers and tracing profilers, and already
  20. includes the logging code for common Godot events for use with a tracing profiler!
  21. Different problems may be easier to debug with one kind of profiler over the other,
  22. but it's difficult to provide a set of rules for which to use. Give both a try,
  23. and see what you can learn from them!
  24. .. toctree::
  25. :maxdepth: 1
  26. :name: toc-devel-using-cpp-profilers
  27. profiling/sampling_profilers
  28. profiling/tracing_profilers