source:
tools/baseline.py
@
7c2c37a
Last change on this file since 7c2c37a was c6f1f3e, checked in by , 5 years ago | |
---|---|
|
|
File size: 1.0 KB |
Rev | Line | |
---|---|---|
[c6f1f3e] | 1 | #!/usr/bin/python3 |
2 | ||
3 | import sys | |
4 | ||
5 | import urllib.request | |
6 | import re | |
7 | import json | |
8 | ||
9 | if len(sys.argv) != 3 : | |
10 | sys.exit("Expected architecture and file name as arguments") | |
11 | ||
12 | build_cache = {} | |
13 | ||
14 | def build(number): | |
15 | if number in build_cache: | |
16 | return build_cache[number] | |
17 | ||
18 | url = "https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/%s/api/json?" % number | |
19 | f = urllib.request.urlopen(url) | |
20 | j = json.loads(f.read().decode("utf-8")) | |
21 | res = re.search("([^:]+):(x86|x64)", j['description']) | |
22 | ||
23 | build_cache.update({number : (res.group(1), res.group(2))}) | |
24 | return build_cache[number] | |
25 | ||
26 | content = {} | |
27 | try: | |
28 | with open(sys.argv[2]) as f: | |
29 | f.readline() | |
30 | f.readline() | |
31 | ||
32 | for l in f: | |
33 | data = [d.replace('"', '') for d in l.split(',')] | |
34 | number = data[2] | |
35 | _, arch = build(number) | |
36 | if arch == sys.argv[1]: | |
37 | if not data[1] in content: | |
38 | content.update({data[1] : []}) | |
39 | ||
40 | content[data[1]].append(float(data[0])) | |
41 | except IOError as e: | |
42 | sys.exit(e.strerror) | |
43 | ||
44 | print(','.join(content.keys())) | |
45 | print(','.join([str(sum(vals) / len(vals)) for vals in content.values()])) |
Note: See TracBrowser
for help on using the repository browser.