diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2020-01-31 13:34:16 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2020-03-01 20:29:18 +0000 |
commit | db4722b49a13557c4a987893f5455001188d4400 (patch) | |
tree | 95e7738f2f465c0e394433b1098912373854cfc5 /tools | |
parent | aedc84f95415cdeb384da85c1fd271564832870d (diff) | |
download | klee-db4722b49a13557c4a987893f5455001188d4400.tar.gz |
[klee-stats] Refactor CSV printout in own function
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/klee-stats/klee-stats | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tools/klee-stats/klee-stats b/tools/klee-stats/klee-stats index 5bc00e04..98062d09 100755 --- a/tools/klee-stats/klee-stats +++ b/tools/klee-stats/klee-stats @@ -241,6 +241,20 @@ def grafana(dirs, host_address, port): app.run(host=host_address, port=port) return 0 + +def write_csv(data): + import csv + data = data[0] + c = data.conn.cursor() + sql3_cursor = c.execute("SELECT * FROM stats") + csv_out = csv.writer(sys.stdout) + # write header + csv_out.writerow([d[0] for d in sql3_cursor.description]) + # write data + for result in sql3_cursor: + csv_out.writerow(result) + + def main(): parser = argparse.ArgumentParser( description='output statistics logged by klee', @@ -313,16 +327,7 @@ def main(): data = [LazyEvalList(d) for d in valid_log_files] if args.toCsv: - import csv - data = data[0] - c = data.conn.cursor() - sql3_cursor = c.execute("SELECT * FROM stats") - csv_out = csv.writer(sys.stdout) - # write header - csv_out.writerow([d[0] for d in sql3_cursor.description]) - # write data - for result in sql3_cursor: - csv_out.writerow(result) + write_csv(data) return if len(data) > 1: @@ -372,6 +377,6 @@ def main(): stream = '\n'.join(stream) print(stream) - + if __name__ == '__main__': main() |