Skip to content

Throughput metric

Bases: LMOperationalMetric

Throughput in LM calls per second (RPS) over this run.

Example:

program.compile(
    metrics=[
        synalinks.metrics.Throughput(),
    ],
)
Source code in synalinks/src/metrics/lm_metrics.py
@synalinks_export("synalinks.metrics.Throughput")
class Throughput(LMOperationalMetric):
    """Throughput in LM calls per second (RPS) over this run.

    Example:

    ```python
    program.compile(
        metrics=[
            synalinks.metrics.Throughput(),
        ],
    )
    ```
    """

    def __init__(self, name="throughput"):
        super().__init__(name=name)

    def result(self):
        wall = self._wall_clock_delta()
        if wall <= 0.0:
            return 0.0
        return self._delta("calls") / wall