Skip to content
Myr

plot_utils.py

This file

Path

scripts/plot_utils.py

32 lines · 1.0 KiB · Python

Last changed by

Support hardware counters in plotting scripts (#984)David Peterbefore adoptione262cd6

History of this file

Take it

Support all exported metrics in plotting scripts (#981)David Peterbefore adoptionef86c83

lines 1–7why, one step back
1"""Shared metric options for the plotting scripts."""
23METRICS = {4 "time_wall_clock": ("Time [s]", 1),5 "time_user": ("User CPU time [s]", 1),6 "time_system": ("System CPU time [s]", 1),7 "memory_peak_resident": ("Peak resident memory [MiB]", 1024**2),

Support hardware counters in plotting scripts (#984)David Peterbefore adoptione262cd6

lines 8–12why, one step back
8 "cpu_cycles": ("CPU cycles", 1),
9 "instructions": ("Completed CPU instructions", 1),10 "cache_references": ("Cache references", 1),11 "cache_misses": ("Cache misses", 1),12 "branch_misses": ("Mispredicted branches", 1),

Support all exported metrics in plotting scripts (#981)David Peterbefore adoptionef86c83

lines 13–21why, one step back
13}
141516def add_metric_argument(parser):17 parser.add_argument(18 "--metric",19 choices=METRICS,20 default="time_wall_clock",21 help="Metric to plot (default: time_wall_clock). "

Support hardware counters in plotting scripts (#984)David Peterbefore adoptione262cd6

line 22why, one step back
22 "Times are in seconds; memory is in MiB; hardware counters are unscaled counts.",

Support all exported metrics in plotting scripts (#981)David Peterbefore adoptionef86c83

lines 23–32why, one step back
23 )
242526def validate_metric(parser, results, metric):27 for result in results:28 if metric not in result["summary"]:29 parser.error(30 f"metric {metric!r} is unavailable for "31 f"{result.get('name', result['command'])!r}"32 )