logo
Expand description

🚄 Profiler API

This provides bindings between the Puffin Profiler library and Ark.

Usage

In Cargo.toml:

  • Add "profiler" to the ark features list.

In your lib.rs you need a call require_profiler_api();. To enable profiling you need to call ark::setup_profiler!(); from your module entry point.

Now you can add profile scopes with ark::profiler::function!(); in functions you want to profile.

You should now be able to see your profile scopes in the ark-client profiler window.

It is also recommended that you call ark::profiler::set_scopes_on(ark::profiler::is_active()); on each frame update, to allow ark-client to switch the module profiler on/off.

Macros

Automatically name the profiling scope based on function name.
Profile the current scope with the given name (unique in the parent scope).
Call at least once from your Module setup code to enable profiling using the puffin profiler.

Functions

Is the module-side profiler on?
Current time in nanoseconds, from some unspecified event.
Report Puffin profiler event stream
Turn on/off the profiler macros (profile_function, profile_scope etc). When off, these calls take only 1-2 ns to call (100x faster). This is false by default.