TimingsCollector#
- class ansys.fluent.mcp.common.timings.TimingsCollector#
Process-wide singleton. Thread-safe. No async is required.
Overview#
Record timing information for an operation. |
|
Context manager: |
|
Return a JSON-friendly view, sorted by the |
|
One row per scope with totals, providing a cheap top-line metric. |
|
Return process uptime in seconds. |
|
Reset collected timing information. |
Import detail#
from ansys.fluent.mcp.common.timings import TimingsCollector
Method detail#
- TimingsCollector.record(scope: str, key: str, elapsed_ms: float, *, errored: bool = False) None#
Record timing information for an operation.
- TimingsCollector.time(scope: str, key: str) Iterator[None]#
Context manager:
with timings.time('tool', name): ....
- TimingsCollector.snapshot() dict[str, list[dict[str, float | int | str]]]#
Return a JSON-friendly view, sorted by the
total_msdescription per scope.This approach ensures the slow paths sit at the top.
- TimingsCollector.summary() dict[str, dict[str, float | int]]#
One row per scope with totals, providing a cheap top-line metric.