Raxol.Core.Performance.Profiler (Raxol v2.0.1)
View SourcePerformance profiling and optimization tools for Raxol.
Provides instrumentation, profiling, and analysis capabilities to identify and optimize performance bottlenecks in the application.
Features
- Function execution timing
- Memory usage tracking
- Hot path identification
- Performance regression detection
- Automatic optimization suggestions
Usage
import Raxol.Core.Performance.Profiler
# Profile a function
profile :my_operation do
expensive_computation()
end
# Get performance report
Profiler.report()
Summary
Functions
Benchmarks a function with multiple iterations.
Benchmarks a function with multiple iterations (function version).
Returns a specification to start this module under a supervisor.
Clears all profiling data.
Compares performance of two implementations.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Identifies hot paths in the application.
Profiles a code block and records metrics.
Executes and profiles a function.
Profiles memory usage of a function.
Profiles memory usage of a function (function version).
Generates a performance report.
Suggests optimizations based on profiling data.
Types
@type metric_type() :: :execution_time | :memory_usage | :call_count | :gc_runs
@type profile_data() :: %{ operation: atom(), metrics: map(), timestamp: DateTime.t(), metadata: map() }
Functions
Benchmarks a function with multiple iterations.
Examples
benchmark(:sort_algorithm, iterations: 1000) do
Enum.sort(large_list)
end
Benchmarks a function with multiple iterations (function version).
Returns a specification to start this module under a supervisor.
See Supervisor.
Clears all profiling data.
Compares performance of two implementations.
Examples
compare(:string_concat,
old: fn -> str1 <> str2 end,
new: fn -> [str1, str2] |> IO.iodata_to_binary() end
)
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Identifies hot paths in the application.
Profiles a code block and records metrics.
Options
:sample_rate- Sampling rate (0.0 to 1.0, default: 1.0):trace- Enable detailed tracing (default: false):metadata- Additional metadata to record
Examples
profile :database_query, metadata: %{query: "SELECT *"} do
Repo.all(User)
end
Executes and profiles a function.
Profiles memory usage of a function.
Profiles memory usage of a function (function version).
Generates a performance report.
Suggests optimizations based on profiling data.