batch
batch
¶
Batch-level energy accounting — group requests and compute per-token energy.
Classes¶
BatchMetrics
dataclass
¶
BatchMetrics(
batch_id: str = "",
total_requests: int = 0,
total_tokens: int = 0,
total_energy_joules: float = 0.0,
energy_per_token_joules: float = 0.0,
energy_per_request_joules: float = 0.0,
mean_power_watts: float = 0.0,
mean_throughput_tok_per_sec: float = 0.0,
prefill_energy_joules: float = 0.0,
decode_energy_joules: float = 0.0,
per_request_energy: List[float] = list(),
)
Aggregated metrics for a batch of inference requests.
EnergyBatch
¶
Group inference requests into a batch and compute per-token energy.
Works with or without an EnergyMonitor. When no monitor is provided,
request counts are still tracked but energy values stay at zero.
Source code in src/diapason/telemetry/batch.py
Methods:¶
sample
¶
Wrap an energy monitor sample and provide a context for recording requests.
Yields a _BatchContext whose record_request() method should be
called once per inference request inside the block.