Raxol.Core.Performance (Raxol v2.0.1)

View Source

Core performance module for Raxol framework.

This module provides basic performance monitoring and statistics functionality with pure functional error handling patterns.

Summary

Functions

Gets performance analysis results.

Gets current performance statistics.

Initializes the performance monitoring system.

Records a performance measurement.

Functions

get_analysis()

@spec get_analysis() :: {:ok, map()} | {:error, term()}

Gets performance analysis results.

Returns

  • {:ok, analysis} - Performance analysis results
  • {:error, reason} - Failed to get analysis

get_stats()

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

Gets current performance statistics.

Returns

  • {:ok, stats} - Performance statistics map
  • {:error, reason} - Failed to get performance stats

Example

{:ok, stats} = Raxol.Core.Performance.get_stats()
# Returns: {:ok, %{cpu_usage: 15.2, memory_usage: 45.8, render_time: 120}}

init(options \\ [])

@spec init(keyword()) :: :ok | {:error, term()}

Initializes the performance monitoring system.

Parameters

  • options - Configuration options for performance monitoring (optional)

Returns

  • :ok - Performance system initialized successfully
  • {:error, reason} - Failed to initialize performance system

record_measurement(name, value, tags \\ [])

@spec record_measurement(String.t(), number(), keyword()) :: :ok

Records a performance measurement.

Parameters

  • name - Measurement name
  • value - Measurement value (typically time in milliseconds)
  • tags - Optional tags as keyword list

Returns

  • :ok - Measurement recorded successfully
  • {:error, reason} - Failed to record measurement