commit 34d85e3ad6733caed3dcd63931281d254d82354c
parent e1116a8f17fbc39df03546199e8602247dc2ddd3
Author: Walther Chen <walther.chen@gmail.com>
Date:   Fri,  1 Nov 2024 11:06:10 -0400

Benchmarking

Diffstat:
Mjustfile | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/justfile b/justfile @@ -11,3 +11,19 @@ # using compile-run prints a bunch of logs run problem *args="": just build {{problem}} -O5 && time -pq ./{{problem}} {{args}} && rm ./{{problem}} + +bench problem *args="": + just build {{problem}} -O5 && \ + poop "./{{problem}}" + +# can inspect results with `perf report` +# sudo sysctl kernel.perf_event_paranoid=1 +# sudo sysctl kernel.kptr_restrict=0 +perf bin *args="": + perf record --call-graph dwarf ./{{bin}} {{args}} > /dev/null + +# stackcollapse-perf.pl and flamegraph.pl symlinked into path from flamegraph repo +flamegraph: + perf script | stackcollapse-perf.pl | flamegraph.pl > perf.svg + +