From 75c3cb003818b59512b3d42acceaaf560c641496 Mon Sep 17 00:00:00 2001 From: Micaela Verucchi Date: Tue, 23 Nov 2021 13:01:58 +0100 Subject: [PATCH] Add script to compare times_rtinference.csv files Signed-off-by: Micaela Verucchi --- scripts/checkExecTimes.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 scripts/checkExecTimes.py diff --git a/scripts/checkExecTimes.py b/scripts/checkExecTimes.py new file mode 100644 index 0000000..c3e1b0b --- /dev/null +++ b/scripts/checkExecTimes.py @@ -0,0 +1,37 @@ +import sys +import pandas as pd + +if len(sys.argv) < 3: + print("Error: two csv files are needed, old first new second") + exit(1) + +old_perf_file = str(sys.argv[1]) +new_perf_file = str(sys.argv[2]) + +verbose = False +if len(sys.argv) == 4: + verbose = bool(sys.argv[3]) + +print("Comparing {} vs {}".format(old_perf_file, new_perf_file)) + +df_old = pd.read_csv (old_perf_file, sep=';', header=None, index_col=0) +df_new = pd.read_csv (new_perf_file, sep=';', header=None, index_col=0) + +for index, row in df_new.iterrows(): + if index in df_old.index: + if verbose: + print("New: ",row[1], row[2], row[3]) + print("Old: ",df_old.loc[index][1], df_old.loc[index][2], df_old.loc[index][3]) + + print(index, end=': ') + if abs(row[1] - df_old.loc[index][1]) < df_old.loc[index][1]*0.1: + print("similar performance") + elif (row[1] < df_old.loc[index][1]): + print('\x1b[3;30;42m' + 'faster' + '\x1b[0m') + elif (row[1] > df_old.loc[index][1]): + if row[1] > df_old.loc[index][1] + df_old.loc[index][1] * 0.5 : + print('\x1b[3;30;41m' + 'WAY SLOWER' + '\x1b[0m') + else: + print('\x1b[3;30;41m' + 'slower' + '\x1b[0m') + +