Version: stable
FUNCTION | |
---|---|
profiler.get_memory_usage() | get current memory usage for app reported by OS |
profiler.get_cpu_usage() | get current CPU usage for app reported by OS |
profiler.enable_ui() | enables or disables the on-screen profiler ui |
profiler.set_ui_mode() | sets the the on-screen profiler ui mode |
profiler.set_ui_view_mode() | sets the the on-screen profiler ui view mode |
profiler.set_ui_vsync_wait_visible() | Shows or hides the vsync wait time in the on-screen profiler ui |
profiler.recorded_frame_count() | get the number of recorded frames in the on-screen profiler ui |
profiler.view_recorded_frame() | displays a previously recorded frame in the on-screen profiler ui |
CONSTANT | |
---|---|
profiler.MODE_RUN | continously show latest frame |
profiler.MODE_PAUSE | pause on current frame |
profiler.MODE_SHOW_PEAK_FRAME | pause at peak frame |
profiler.MODE_RECORD | start recording |
profiler.VIEW_MODE_FULL | show full profiler ui |
profiler.VIEW_MODE_MINIMIZED | show mimimal profiler ui |
profiler.get_memory_usage()
OS | Value |
---|---|
iOS MacOS Androd Linux |
Resident memory |
Windows | Working set |
HTML5 | Not available |
PARAMETERS
RETURNS
bytes |
used by the application |
EXAMPLES
Get memory usage before and after loading a collection:print(profiler.get_memory_usage()) msg.post("#collectionproxy", "load") ... print(profiler.get_memory_usage()) -- will report a higher number than the initial call
profiler.get_cpu_usage()
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.)
PARAMETERS
RETURNS
percent |
of CPU used by the application |
profiler.enable_ui(enabled)
PARAMETERS
enabled |
true to enable, false to disable |
EXAMPLES
-- Show the profiler UI profiler.enable_ui(true)
profiler.set_ui_mode(mode)
PARAMETERS
mode |
the mode to set the ui profiler in
MODE_PAUSE or MODE_RUN .
You can also use the view_recorded_frame function to display a recorded frame. Doing so stops the recording as well.
Every time you switch to recording mode the recording buffer is cleared.
The recording buffer is also cleared when setting the MODE_SHOW_PEAK_FRAME mode. |
EXAMPLES
function start_recording() profiler.set_ui_mode(profiler.MODE_RECORD) end function stop_recording() profiler.set_ui_mode(profiler.MODE_PAUSE) end
profiler.set_ui_view_mode(mode)
PARAMETERS
mode |
the view mode to set the ui profiler in
|
EXAMPLES
-- Minimize the profiler view profiler.set_ui_view_mode(profiler.VIEW_MODE_MINIMIZED)
profiler.set_ui_vsync_wait_visible(visible)
PARAMETERS
visible |
true to include it in the display, false to hide it. |
EXAMPLES
-- Exclude frame wait time form the profiler ui profiler.set_ui_vsync_wait_visible(false)
profiler.recorded_frame_count()
PARAMETERS
RETURNS
frame_count |
the number of recorded frames, zero if on-screen profiler is disabled |
EXAMPLES
-- Show the last recorded frame local recorded_frame_count = profiler.recorded_frame_count() profiler.view_recorded_frame(recorded_frame_count)
profiler.view_recorded_frame(frame_index)
PARAMETERS
frame_index |
a table where you specify one of the following parameters:
|
EXAMPLES
-- Go back one frame profiler.view_recorded_frame({distance = -1})
continously show latest frame
continously show latest frame
pause on current frame
pause on current frame
pause at peak frame
pause at peak frame
start recording
start recording
show full profiler ui
show full profiler ui
show mimimal profiler ui
show mimimal profiler ui