Support all exported metrics in plotting scripts (#981)

This commit is contained in:
David Peter authored and GitHub committed 2026-10-05 22:48:06 +02:00
1 parent f26c015518
commit ef86c830b5
6 files changed
+115 -40

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
"""Shared metric options for the plotting scripts."""
METRICS = {
"time_wall_clock": ("Time [s]", 1),
"time_user": ("User CPU time [s]", 1),
"time_system": ("System CPU time [s]", 1),
"memory_peak_resident": ("Peak resident memory [MiB]", 1024**2),
}
def add_metric_argument(parser):
parser.add_argument(
"--metric",
choices=METRICS,
default="time_wall_clock",
help="Metric to plot (default: time_wall_clock). "
"Times are in seconds; memory is in MiB.",
)
def validate_metric(parser, results, metric):
for result in results:
if metric not in result["summary"]:
parser.error(
f"metric {metric!r} is unavailable for "
f"{result.get('name', result['command'])!r}"
)