source: benchmark/baselines/calc.py @ 809e058

ADTast-experimental
Last change on this file since 809e058 was c6f1f3e, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Jenkins now also computes various speed-up graphs for performance monitoring

  • Property mode set to 100755
File size: 897 bytes
Line 
1#!/usr/bin/python3
2
3import sys
4
5if len(sys.argv) != 3:
6        print("Usage: %s baseline.csv result.csv" % sys.argv[0], file=sys.stderr)
7        exit(1)
8
9with open(sys.argv[1]) as baseline, open(sys.argv[2]) as result:
10        contentB = baseline.read().splitlines()
11        contentR = result  .read().splitlines()
12        headerB = contentB[0].split(',')
13        headerR = contentR[0].split(',')
14        valuesB = [float(v) for v in contentB[1].split(',')]
15        valuesR = [float(v) for v in contentR[1].split(',')]
16
17        dataB = {label: value for label, value in zip(headerB, valuesB)}
18        dataR = {label: value for label, value in zip(headerR, valuesR)}
19
20        if set(dataB) - set(dataR) or set(dataR) - set(dataB):
21                print("Error: baseline and result differ in number of values", file=sys.stderr)
22                exit(2)
23
24        out = {label : "{0:.3f}".format(num / dataB[label]) for label, num in dataR.items()}
25
26        print(','.join( out.keys() ))
27        print(','.join( out.values() ))
Note: See TracBrowser for help on using the repository browser.