Raxol.Core.Performance (Raxol v2.6.0)

View Source

Performance monitoring facade for Raxol.Core.

Provides a simple interface for performance initialization and statistics gathering. This module serves as the entry point for performance monitoring used by the Core module.

For detailed performance analysis, see the modules in Raxol.Performance.*:

Summary

Types

Performance statistics map

Functions

Gets current performance statistics.

Initializes the performance monitoring system.

Records a frame render event.

Resets performance statistics.

Types

stats()

@type stats() :: %{
  uptime_ms: number(),
  frame_count: non_neg_integer(),
  avg_frame_time_ms: float(),
  fps: float(),
  memory_mb: float(),
  samples: non_neg_integer(),
  initialized: boolean()
}

Performance statistics map

Functions

get_stats()

@spec get_stats() :: {:ok, stats()}

Gets current performance statistics.

Returns

  • {:ok, stats} where stats is a map containing:
    • :uptime_ms - Time since initialization in milliseconds
    • :frame_count - Total frames rendered
    • :avg_frame_time_ms - Average frame render time
    • :fps - Estimated frames per second
    • :memory_mb - Current memory usage in MB

init(options \\ [])

@spec init(keyword()) :: :ok

Initializes the performance monitoring system.

Options

  • :enabled - Whether to enable performance monitoring (default: true)
  • :max_samples - Maximum number of samples to keep (default: 100)

Returns

  • :ok on success

record_frame(render_time_us)

@spec record_frame(non_neg_integer()) :: :ok

Records a frame render event.

Parameters

  • render_time_us - Render time in microseconds

reset()

@spec reset() :: :ok

Resets performance statistics.