Raxol.Performance.DevProfiler (Raxol v2.0.1)
View SourceDevelopment-mode profiler for detailed performance analysis.
Provides detailed profiling capabilities specifically for development, including function call tracing, memory analysis, and hot spot detection.
Features
- Function call tracing with timing
- Memory allocation tracking
- Process hot spot detection
- Call graph generation
- Profiling reports with optimization suggestions
Usage
# Profile a specific function
DevProfiler.profile(fn ->
SomeModule.expensive_function()
end)
# Profile with options
DevProfiler.profile([duration: 5000, memory: true], fn ->
run_workload()
end)
# Enable continuous profiling
DevProfiler.start_continuous(interval: 10_000)
Summary
Functions
Analyze current system performance and provide hints.
Profile a function call with detailed analysis.
Profile memory usage over time.
Start continuous profiling for ongoing performance monitoring.
Types
@type profile_opts() :: [ duration: pos_integer(), memory: boolean(), processes: boolean(), call_graph: boolean(), output_format: :text | :html | :json ]
Functions
Analyze current system performance and provide hints.
@spec profile(profile_opts() | (-> any()), (-> any()) | nil) :: any()
Profile a function call with detailed analysis.
Options
:duration- Maximum profiling duration in milliseconds:memory- Include memory profiling:processes- Include process analysis:call_graph- Generate call graph (expensive):output_format- Output format (:text, :html, :json)
Examples
# Basic profiling
result = DevProfiler.profile(fn ->
perform_complex_operation()
end)
# With memory analysis
DevProfiler.profile([memory: true], fn ->
process_large_buffer()
end)
Profile memory usage over time.
Start continuous profiling for ongoing performance monitoring.
Options
:interval- Profiling interval in milliseconds (default: 30000):duration- Duration of each profiling session (default: 5000):auto_hints- Enable automatic performance hints (default: true)
Example
# Start continuous profiling every 30 seconds
DevProfiler.start_continuous(interval: 30_000, duration: 5_000)