Bases: ProgramOperationalMetric
Program calls per wall-clock second; use for serving throughput.
Example:
program.compile(
metrics=[
synalinks.metrics.ProgramCallsPerSecond(),
],
)
Source code in synalinks/src/metrics/program_metrics.py
| @synalinks_export("synalinks.metrics.ProgramCallsPerSecond")
class ProgramCallsPerSecond(ProgramOperationalMetric):
"""Program calls per wall-clock second; use for serving throughput.
Example:
```python
program.compile(
metrics=[
synalinks.metrics.ProgramCallsPerSecond(),
],
)
```
"""
direction = "up"
def __init__(self, name="program_calls_per_second", description=None):
super().__init__(name=name, description=description)
def result(self):
# Wall clock, not summed per-call time: batch calls run concurrently.
wall = read_phase_wall_clock_s(self._phase, self._phase_clock)
wall -= self._wall_baseline
if wall <= 0.0:
return 0.0
return self._delta_program("invocations") / wall
|