diff options
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | test/plots/plot_perf.py | 30 |
2 files changed, 34 insertions, 0 deletions
@@ -43,6 +43,9 @@ perf: ${PERF_SCRIPTS} mkdir -p .perf echo $^ | env DIR=".perf" xargs -n 1 python +perf-plots: + python test/plots/plot_perf.py -d .perf + doc-coverage: interrogate -vv -nmps -e pyecsca/ec/std/.github/ -f 55 pyecsca @@ -65,6 +68,7 @@ help: @echo " - black: Run black on pyecsca sources (will transform them inplace)." @echo " - black-all: Run black on pyecsca sources and tests (will transform them inplace)." @echo " - perf: Run performance measurements (prints results and stores them in .perf/)." + @echo " - perf-plots: Plot performance measurements (stores the plots in .perf/)." @echo " - doc-coverage: Use interrogate to check documentation coverage of public API." @echo " - docs: Build docs using sphinx." @echo " - help: Show this help." diff --git a/test/plots/plot_perf.py b/test/plots/plot_perf.py new file mode 100644 index 0000000..7054543 --- /dev/null +++ b/test/plots/plot_perf.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +import click + +from pathlib import Path +import holoviews as hv +import numpy as np + + +@click.command() +@click.option( + "-d", + "--directory", + type=click.Path(file_okay=False, dir_okay=True), + default=None, + envvar="DIR", + required=True +) +def main(directory): + directory = Path(directory) + for f in directory.glob("*.csv"): + pname = str(f).removesuffix(".csv") + d = np.genfromtxt(f, delimiter=",", dtype=None, encoding="ascii", names=("commit", "pyversion", "time")) + if len(d.shape) == 0: + d.shape = (1,) + line = hv.Curve(zip(d["commit"], d["time"]), "commit", "duration") + hv.save(line, pname + ".svg", fmt="svg") + + +if __name__ == "__main__": + main() |
