- Select ref document -

Profiler API documentation

version 1.2.144

Functions for getting profiling data in runtime. More detailed profiling and debugging information can be found under the Debugging section in the manuals.

Functions

profiler.get_cpu_usage

profiler.get_cpu_usage()

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

percent

number of CPU used by the application

percent

number of CPU used by the application

profiler.get_memory_usage

profiler.get_memory_usage()

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
MacOS

Androd
Linux
Resident memory
Windows Working set
HTML5 Not available

Returns

bytes

number used by the application

bytes

number 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