nat.profiler.calc.plot#

Attributes#

Classes#

Functions#

plot_concurrency_vs_time_metrics_simple(→ None)

Save a simple plot of concurrency vs. p95 LLM latency and workflow runtime.

plot_metric_vs_concurrency_with_optional_fit(ax, x, y, ...)

Helper to plot a metric vs concurrency with pre-computed fit, outlier highlighting, and SLA line.

plot_concurrency_vs_time_metrics(→ None)

Plot concurrency vs. p95 latency and workflow runtime using metrics_per_concurrency.

Module Contents#

logger#
class PlotConfig#
SIMPLE_FIGSIZE = (12, 6)#
SIMPLE_LINEWIDTH = 2#
SIMPLE_DPI = 150#
ENHANCED_FIGSIZE = (16, 6)#
ENHANCED_DPI = 300#
DATA_MARKER = 'o'#
OUTLIER_MARKER = 'x'#
OUTLIER_COLOR = 'crimson'#
TREND_COLOR = 'r'#
TREND_LINESTYLE = '--'#
TREND_ALPHA = 0.8#
TREND_LINEWIDTH = 2.0#
LLM_LATENCY_COLOR = 'steelblue'#
RUNTIME_COLOR = 'darkgreen'#
SLA_COLOR = 'red'#
NOTE_BOX_COLOR = 'mistyrose'#
NOTE_TEXT_COLOR = 'crimson'#
STATS_BOX_COLOR = 'lightblue'#
DATA_ALPHA = 0.7#
OUTLIER_ALPHA = 0.9#
GRID_ALPHA = 0.3#
SLA_ALPHA = 0.7#
NOTE_BOX_ALPHA = 0.7#
STATS_BOX_ALPHA = 0.8#
DATA_POINT_SIZE = 120#
OUTLIER_POINT_SIZE = 140#
DATA_LINEWIDTH = 1#
AXIS_LABEL_FONTSIZE = 12#
TITLE_FONTSIZE = 14#
LEGEND_FONTSIZE = 10#
NOTE_FONTSIZE = 10#
STATS_FONTSIZE = 10#
NOTE_X_POS = 0.98#
NOTE_Y_POS = 0.02#
STATS_X_POS = 0.02#
STATS_Y_POS = 0.02#
NOTE_BOX_PAD = 0.3#
STATS_BOX_PAD = 0.5#
TREND_LINE_POINTS = 100#
AXIS_LABEL_FONTWEIGHT = 'bold'#
TITLE_FONTWEIGHT = 'bold'#
plot_concurrency_vs_time_metrics_simple(
df: pandas.DataFrame,
output_dir: pathlib.Path,
) None#

Save a simple plot of concurrency vs. p95 LLM latency and workflow runtime.

plot_metric_vs_concurrency_with_optional_fit(
ax: matplotlib.pyplot.Axes,
x: numpy.ndarray,
y: numpy.ndarray,
metric_name: str,
y_label: str,
title: str,
color: str,
sla_value: float = 0.0,
sla_label: str = None,
fit: nat.profiler.calc.data_models.LinearFitResult | None = None,
)#

Helper to plot a metric vs concurrency with pre-computed fit, outlier highlighting, and SLA line. Requires pre-computed fit to be provided.

plot_concurrency_vs_time_metrics(
metrics_per_concurrency: dict[int, nat.profiler.calc.data_models.SizingMetrics],
output_dir: pathlib.Path,
target_llm_latency: float = 0.0,
target_runtime: float = 0.0,
llm_latency_fit: nat.profiler.calc.data_models.LinearFitResult | None = None,
runtime_fit: nat.profiler.calc.data_models.LinearFitResult | None = None,
) None#

Plot concurrency vs. p95 latency and workflow runtime using metrics_per_concurrency. Enhanced with better styling, trend analysis, and annotations. Only plots valid runs and requires pre-computed fits.