Raxol. Performance. CycleProfiler
(Raxol v2.6.0)
View Source
Profiles TEA update/view/render cycle timings.
Records per-cycle timing breakdowns in a CircularBuffer, computes rolling statistics, and detects slow cycles that exceed the budget threshold.
Usage
Raxol.start_link(MyApp, profiler: true)
Raxol.start_link(MyApp, profiler: [max_entries: 2000, slow_threshold_us: 33_333])
CycleProfiler.stats() # => %{update: %{...}, render: %{...}}
CycleProfiler.slow_cycles() # => [%RenderTiming{...}]
CycleProfiler.export(path) # => :ok
CycleProfiler.reset() # => :okZero cost when disabled -- the Dispatcher and Engine check for nil pid
before calling any recording functions.
Summary
Functions
Returns a specification to start this module under a supervisor.
Returns the total and slow cycle counts.
Exports profiling data to a file (Erlang term format).
Records a render cycle timing. Called by the Engine.
Records an update cycle timing. Called by the Dispatcher.
Resets all recorded data.
Returns render cycles that exceeded the slow threshold.
Starts the cycle profiler.
Returns computed statistics for update and render cycles.
Subscribes the calling process to slow-cycle notifications.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec counts(pid() | atom()) :: %{total: non_neg_integer(), slow: non_neg_integer()}
Returns the total and slow cycle counts.
Exports profiling data to a file (Erlang term format).
Records a render cycle timing. Called by the Engine.
Records an update cycle timing. Called by the Dispatcher.
Resets all recorded data.
Returns render cycles that exceeded the slow threshold.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the cycle profiler.
Returns computed statistics for update and render cycles.
Subscribes the calling process to slow-cycle notifications.