Profiling

This section explains how to use the Profile tab in the Debug Module.

The Debug Module permits you to step through your code and find any issues with the code base, but sometimes you need to check for subtler details in order to properly optimise your games. The Profile option helps to do just that by giving you a performance overview, showing the time takes to call functions, scripts, and even how long it took a specific event to complete.

Profile Controls

As you can see form the image above, you set the Profile as a window in the Debug Module, and has a button for enabling/disabling profiling, the number of steps that have been profiled, as well as a two sections which you can use to display the information in different ways.

Clicking the enable/disable button will switch profiling on or off for the game being debugged, while the value next to it shows the total number of steps that have been profiled. Beside that you can also see either the total time taken for the profile, or the average time taken per step. Which value you view will depend on the button for selecting the format, which also changes the way that the Time and Calls data is displayed, with "Total" being the total number of calls made to the function, script or event and the total time taken (times are in microseconds) over the course of the profile. Setting this to "Average" will make these columns show the average time taken per step for each function, script or event, and the average number of times that it was called. You can also click the "Run Game At Maximum Room Speed" button to force the debugger to remove the room speed clamp and try to run the game at the real FPS.

The other two options are for controlling what exactly you are profiling and the data that is shown. The first option is for selecting how to view the data, and you can choose from the following:

The second option is for selecting what data is shown, whether it should be the event and code data, the engine data, or both. If you choose "GML", then you will get the events, functions and codes being called each step while the "Engine" view will only show the engine calls required by the game, enabling you to see any bottlenecks in the way that your game is handling things. If you select both, then both sets of data will be displayed, and the "Engine" data will be coloured differently to help you differentiate it from the functions.

Profile Data

The profile data is shown in four columns, and clicking on any of them will sort the data according to the column criteria.

Exporting Data

You can export the profile data at any time by right clicking on the window and selecting the "Export to file" option. This will write the current view (after expanding all the nodes) in .csv format, which you can then load into any spreadsheet, like Excel for example.


Back: The Debug Module
Next : Debugging
© Copyright YoYo Games Ltd. 2018 All Rights Reserved