diff --git a/wrk/graph.py b/wrk/graph.py index 617a590..b446d98 100644 --- a/wrk/graph.py +++ b/wrk/graph.py @@ -5,7 +5,7 @@ from matplotlib.ticker import FuncFormatter from collections import defaultdict import statistics -directory = "./" # Replace with the actual directory path +directory = "./wrk" # Replace with the actual directory path requests_sec = defaultdict(list) transfers_sec = defaultdict(list) @@ -41,10 +41,18 @@ def plot(kind='', title='', ylabel='', means=None): plt.text(bar.get_x() + bar.get_width() / 2, yval, f'{yval:,.2f}', ha='center', va='bottom') plt.tight_layout() # Adjust the spacing of the graph elements - plt.savefig(f"{kind.lower()}_graph.png") # Save the graph as a PNG file + png_name = f"{directory}/{kind.lower()}_graph.png" + plt.savefig(png_name) # Save the graph as a PNG file + print(f"Generated: {png_name}") if __name__ == '__main__': + if not os.path.isdir(".git"): + print("Please run from root directory of the repository!") + print("e.g. python wrk/graph.py") + import sys + sys.exit(1) + # Iterate over the files in the directory for filename in os.listdir(directory): if filename.endswith(".perflog"): diff --git a/wrk/measure_all.sh b/wrk/measure_all.sh index 7a533ba..0a67338 100755 --- a/wrk/measure_all.sh +++ b/wrk/measure_all.sh @@ -1,9 +1,18 @@ #! /usr/bin/env bash + +if [ ! -d ".git" ] ; then + echo "This script must be run from the root directory of the repository!" + echo "./wrk/measure_all.sh" + exit 1 +fi + SUBJECTS="zig go python sanic rust rust2 axum csharp cpp" for S in $SUBJECTS; do L="$S.perflog" for R in 1 2 3 ; do - ./wrk/measure.sh $S | tee -a $L + ./wrk/measure.sh $S | tee -a wrk/$L done done + +echo "Finished"