Functions for getting profiling data in runtime. More detailed profiling and debugging information available in the manuals.
Static methods
staticenable_ui(enabled:Bool):Void
Creates and shows or hides and destroys the on-sceen profiler ui
The profiler is a real-time tool that shows the numbers of milliseconds spent in each scope per frame as well as counters. The profiler is very useful for tracking down performance and resource problems.
Parameters:
enabled | true to enable, false to disable |
---|
staticget_cpu_usage():Float
Get the percent of CPU usage by the application, as reported by the OS.
This function is not available on HTML5.
For some platforms (Android, Linux and Windows), this information is only available
by default in the debug version of the engine. It can be enabled in release version as well
by checking track_cpu
under profiler
in the game.project
file.
(This means that the engine will sample the CPU usage in intervalls during execution even in release mode.)
Returns:
number of CPU used by the application
staticget_memory_usage():Int
Get the amount of memory used (resident/working set) by the application in bytes, as reported by the OS.
This function is not available on HTML5.
The values are gathered from internal OS functions which correspond to the following;
OS | Value |
---|---|
iOS, OSX, Android and Linux | Resident memory |
Windows | Working set |
HTML5 | Not available |
Returns:
bytes used by the application
staticrecorded_frame_count():Int
Get the number of recorded frames in the on-screen profiler ui recording buffer
Returns:
the number of recorded frames, zero if on-screen profiler is disabled
staticset_ui_mode(mode:ProfilerMode):Void
Set the on-screen profile mode - run, pause, record or show peak frame
Parameters:
mode | the mode to set the ui profiler in
To stop recording, switch to a different mode such as |
---|
staticset_ui_view_mode(mode:ProfilerViewMode):Void
Set the on-screen profile view mode - minimized or expanded
Parameters:
mode | the view mode to set the ui profiler in |
---|
staticset_ui_vsync_wait_visible(visible:Bool):Void
Shows or hides the time the engine waits for vsync in the on-screen profiler
Each frame the engine waits for vsync and depending on your vsync settings and how much time your game logic takes this time can dwarf the time in the game logic making it hard to see details in the on-screen profiler graph and lists.
Also, by hiding this the FPS times in the header show the time spent each time excuding the time spent waiting for vsync. This shows you how long time your game is spending actively working each frame.
This setting also effects the display of recorded frames but does not affect the actual recorded frames so it is possible to toggle this on and off when viewing recorded frames.
By default the vsync wait times is displayed in the profiler.
Parameters:
visible | true to include it in the display, false to hide it. |
---|
staticview_recorded_frame(frame_index:ProfilerViewRecordedFrame):Void
Displays a previously recorded frame in the on-screen profiler ui.
Pauses and displays a frame from the recording buffer in the on-screen profiler ui
The frame to show can either be an absolute frame or a relative frame to the current frame.