Skip to content

ProgramElapsedTime metric

Bases: ProgramOperationalMetric

End-to-end wall-clock seconds spent inside program(...) during this run. Sums per-invocation wall-clock; does not double-count nested LM/EM calls.

Example:

program.compile(
    metrics=[
        synalinks.metrics.ProgramElapsedTime(),
    ],
)
Source code in synalinks/src/metrics/program_metrics.py
@synalinks_export("synalinks.metrics.ProgramElapsedTime")
class ProgramElapsedTime(ProgramOperationalMetric):
    """End-to-end wall-clock seconds spent inside `program(...)` during
    this run. Sums per-invocation wall-clock; does not double-count
    nested LM/EM calls.

    Example:

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

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

    def result(self):
        return float(self._delta_program("invocation_elapsed_s"))