diff --git a/development/cpp/img/cpp_profiler_time_profiler.png b/development/cpp/img/cpp_profiler_time_profiler.png new file mode 100644 index 000000000..f790aa2ba Binary files /dev/null and b/development/cpp/img/cpp_profiler_time_profiler.png differ diff --git a/development/cpp/img/cpp_profiler_time_profiler_record.png b/development/cpp/img/cpp_profiler_time_profiler_record.png new file mode 100644 index 000000000..25bd5fc34 Binary files /dev/null and b/development/cpp/img/cpp_profiler_time_profiler_record.png differ diff --git a/development/cpp/img/cpp_profiler_time_profiler_result.png b/development/cpp/img/cpp_profiler_time_profiler_result.png new file mode 100644 index 000000000..035ad5b01 Binary files /dev/null and b/development/cpp/img/cpp_profiler_time_profiler_result.png differ diff --git a/development/cpp/img/cpp_profiler_xcode_menu.png b/development/cpp/img/cpp_profiler_xcode_menu.png new file mode 100644 index 000000000..c77bc3042 Binary files /dev/null and b/development/cpp/img/cpp_profiler_xcode_menu.png differ diff --git a/development/cpp/using_cpp_profilers.rst b/development/cpp/using_cpp_profilers.rst index c46b597d2..aecded651 100644 --- a/development/cpp/using_cpp_profilers.rst +++ b/development/cpp/using_cpp_profilers.rst @@ -15,6 +15,7 @@ Recommended profilers - `VerySleepy `__ (Windows only) - `HotSpot `__ (Linux only) +- `Xcode Instruments `__ (macOS only) These profilers may not be the most powerful or flexible options, but their standalone operation and limited feature set tends to make them easier to use. @@ -141,3 +142,36 @@ HotSpot Process(es)**. This process attachment-based workflow is similar to the one used by VerySleepy. + +Xcode Instruments +^^^^^^^^^^^^^^^^^ + +- Open Xcode. Select **Open Developer Tool** - **Instruments** from the **Xcode** app menu: +- Double-click on **Time Profiler** in the **Instruments** window: + +.. image:: img/cpp_profiler_xcode_menu.png + +- In the Time Profiler window, click on the **Target** menu, select **Choose target...** + and specify the path to the Godot binary, command line arguments and environment variables + in the next window. + +.. image:: img/cpp_profiler_time_profiler.png + +- You can also attach the Time Profiler to a running process by selecting it from the **Target** + menu. + +- Click the **Start an immediate mode recording** button to start profiling. + +.. image:: img/cpp_profiler_time_profiler_record.png + +- Perform the actions you wish to profile in the editor or project. When you're done, + click the **Stop** button. + +- Wait for the results to appear. +- At the bottom of the window you will see a call tree for all CPU threads started, and + the **Heaviest Stack Trace** overview. +- Select **Hide system libraries** in the **Call Tree** menu (at the bottom of window) to + remove external modules. +- You can use the timeline at the top of the window to display details for the specific time period. + +.. image:: img/cpp_profiler_time_profiler_result.png