User-defined profiling interface.
Implement this class to receive profiling callbacks from the library. The callbacks provide structured timing data (scopes, events, counters) that can be forwarded to any profiling backend – Tracy, Optick, Unreal Insights, the built-in Perfetto trace file writer provided below (CreateProfilerPerfetto()), or a custom implementation.
- Precondition
- Requires the Pro edition or higher.
Usage
- Subclass Profiler and implement all pure virtual methods.
- Call Platform::instance().set_profiler(myProfiler) before creating the Renderer or App.
- Your profiler instance should outlive the Renderer/App.
Frame Timing
The library automatically calls BeginFrame() and EndFrame() around each rendering frame. Implement these to measure dirty-to-display latency and detect jank.
Threading
All methods may be called concurrently from any thread. Implementations must be thread-safe.
- See also
- Platform::set_profiler
|
| virtual | ~Profiler () |
| virtual void | BeginScope (const char *name)=0 |
| | Enter a named profiling scope.
|
| virtual void | EndScope ()=0 |
| | Exit the most recently entered scope on the current thread.
|
| virtual void | BeginFrame (uint64_t frame_id) |
| | Called when a new rendering frame begins.
|
| virtual void | EndFrame () |
| | Called when a rendering frame ends.
|
| virtual void | EmitEvent (const char *name, const char *detail)=0 |
| | Record an instant (point-in-time) event on the timeline.
|
| virtual void | EmitCounter (const char *name, int64_t value)=0 |
| | Record a counter value.
|
| virtual uint64_t | BeginEvent (const char *name, const char *detail)=0 |
| | Begin an async event that may span multiple frames.
|
| virtual void | EndEvent (uint64_t id)=0 |
| | End a previously started async event.
|