nlsq.profiler_visualization module¶
Performance Profiling Visualization¶
Visualization and dashboard tools for NLSQ performance profiling data.
- class nlsq.utils.profiler_visualization.ProfilerVisualization(profiler)[source]
Bases:
objectVisualization tools for performance profiling data.
Examples
>>> from nlsq.utils.profiler import get_global_profiler >>> from nlsq.utils.profiler_visualization import ProfilerVisualization >>> profiler = get_global_profiler() >>> viz = ProfilerVisualization(profiler) >>> fig = viz.plot_timing_comparison(["test1", "test2"]) >>> viz.save_html_report("report.html")
- __init__(profiler)[source]
Initialize visualization tools.
- Parameters:
profiler (PerformanceProfiler) – Profiler instance to visualize
- plot_timing_series(name='default', figsize=(10, 6))[source]
Plot timing metrics across runs.
- plot_timing_comparison(names, figsize=(10, 6))[source]
Compare timing metrics across multiple profiles.
- plot_timing_distribution(name='default', figsize=(10, 6))[source]
Plot distribution of timing metrics.
- generate_html_report(output_path=None)[source]
Generate HTML report with all profiling data.
- class nlsq.utils.profiler_visualization.ProfilingDashboard(profiler)[source]
Bases:
objectInteractive dashboard for profiling data.
Examples
>>> from nlsq.utils.profiler import get_global_profiler >>> from nlsq.utils.profiler_visualization import ProfilingDashboard >>> profiler = get_global_profiler() >>> dashboard = ProfilingDashboard(profiler) >>> dashboard.add_profile("test1") >>> dashboard.add_profile("test2") >>> dashboard.generate_comparison_report()
- __init__(profiler)[source]
Initialize dashboard.
- Parameters:
profiler (PerformanceProfiler) – Profiler instance to visualize
- add_profile(name)[source]
Add a profile to track in the dashboard.
- Parameters:
name (str) – Profile name to track
- remove_profile(name)[source]
Remove a profile from tracking.
- Parameters:
name (str) – Profile name to remove
- generate_comparison_report()[source]
Generate comparison report for tracked profiles.
- Returns:
report – Formatted comparison report
- Return type:
Overview¶
The profiler_visualization module provides visualization tools for profiling data.
Key Features¶
Flame graphs for call stack visualization
Timeline plots for execution traces
Memory usage plots over time
Interactive HTML reports
Functions¶
Example Usage¶
from nlsq.utils.profiler import Profiler
from nlsq.utils.profiler_visualization import plot_timeline, create_html_report
# Profile operations
profiler = Profiler(enable=True)
# ... run profiled code ...
# Visualize results
plot_timeline(profiler.get_results())
# Generate HTML report
create_html_report(profiler.get_results(), output_file="profile_report.html")
See Also¶
nlsq.profiler module - Profiling utilities
nlsq.profiling module - Transfer profiling