]> rtime.felk.cvut.cz Git - nul-nightly.git/blob - wvperfpreprocess.py
New nightly build log
[nul-nightly.git] / wvperfpreprocess.py
1 #!/usr/bin/env python2
2
3 import sys
4 import re
5 import os
6 import os.path
7 import string
8 import time
9
10 re_date = re.compile('^Date: (.*)')
11 re_testing = re.compile('^(\([0-9]+\) (#   )?)?\s*Testing "(.*)" in (.*):\s*$')
12 re_commit = re.compile('.*(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).*, commit: (.*)')
13 re_commithash = re.compile('([0-9a-f]{7})(-dirty)? \(')
14 re_check = re.compile('^(\([0-9]+\) (#   )?)?!\s*(.*?)\s+(\S+)\s*$')
15 re_perf =  re.compile('^(\([0-9]+\) (#   )?)?!\s*(.*?)\s+PERF:\s*(.*?)\s+(\S+)\s*$')
16
17 # State variables
18 date = time.localtime(time.time())
19 linetype = None
20 what = None
21 where = ""
22 commit = None
23 commithash = None
24 basename = None
25 ext = None
26 perf = None
27 key = None
28 val = None
29 units = None
30 tag = None
31
32 def matches(re):
33     global match, line
34     match = re.match(line)
35     return match
36
37 for line in sys.stdin:
38     line = line.rstrip()
39     match = None
40
41     # Parse known lines
42     if matches(re_date):
43         linetype='date'
44         date = time.strptime(match.group(1), "%a, %d %b %Y %H:%M:%S +0200")
45     elif matches(re_testing):
46         linetype='testing'
47         what = match.group(3)
48         where = match.group(4)
49
50         match = re_commit.match(what)
51         if match:
52             linetype='commitid'
53             date = time.strptime(match.group(1), "%Y-%m-%d %H:%M:%S")
54             commit = match.group(2)
55             match = re_commithash.search(commit);
56             if match:
57                 commithash = match.group(1)
58             else:
59                 commithash = None
60
61         (basename, ext) = os.path.splitext(os.path.basename(where))
62     elif matches(re_perf):
63         linetype='perf'
64         perf = match.group(4)
65         perf = perf.split()
66         key = perf[0]
67         try:
68             val = float(perf[1])
69         except ValueError:
70             val = None
71         try:
72             units = perf[2]
73         except:
74             units = None
75     else:
76         linetype='other'
77         continue
78
79     # Rewriting rules
80     if '/vancouver-kernelbuild' in where:
81         if linetype == 'testing':
82             m = re.compile('vancouver-kernelbuild-(.*).wv').search(where)
83             if m: tag = m.group(1)
84             else: tag = 'ept-vpid'
85
86             line='Testing "Kernel compile in ramdisk" in kernelbuild-ramdisk:'
87         if linetype == 'perf':
88             line = line.replace('kbuild', "vm-"+tag);
89             line = line.replace('ok', 'axis="kbuild" ok');
90     if '/kernelbuild-bare-metal.wv' in where:
91         if linetype == 'testing':
92             line='Testing "Kernel compile in ramdisk" in kernelbuild-ramdisk:'
93         if linetype == 'perf':
94             line = line.replace('kbuild', 'bare-metal');
95             line = line.replace('ok', 'axis="kbuild" ok');
96
97     if '/diskbench-vm.wv' in where and linetype == 'perf' and commithash == '7459b8c':
98         # Skip results of test with forgotten debugging output
99         continue
100
101     if 'standalone/basicperf.c' in where and linetype == 'perf' and "PERF: warmup_" in line:
102         # Skip warmup results
103         continue
104
105     if 'vancouver-linux-basic' in where:
106         continue                # Ignore the old test
107
108     if 'diskbench-ramdisk.wv' in where or 'diskbench-ramdisk-old.wv' in where:
109         # Merge graphs for old and new disk protocol
110         if linetype == 'testing' and 'diskbench-ramdisk-old.wv' in where:
111             line = line.replace('diskbench-ramdisk-old.wv', 'diskbench-ramdisk.wv');
112         if linetype == 'perf' and key == 'request_rate':
113             continue # Do not plot request rate
114         if linetype == 'perf' and key == 'throughput' and units:
115             line = line.replace('ok', 'axis="throughput" ok');
116             if 'diskbench-ramdisk-old.wv' in where:
117                 line = line.replace('throughput', 'old-protocol', 1)
118
119     if 'parentperf.' in where or 'parentperfsmp.' in where:
120         if linetype == 'testing':
121             if 'parentperf.wv' in where: smp = False
122             elif 'parentperfsmp.wv' in where: smp = True
123             if what == 'Service without sessions': tag = 'nosess'
124             elif what == 'Service with sessions':  tag = 'sess'
125             elif what == 'Service with sessions (implemented as a subclass of SService)': tag = 'sserv'
126             elif what == 'Service with sessions represented by portals (implemented as a subclass of NoXlateSService)': tag = 'noxsserv'
127             else: tag = None
128         elif linetype == 'perf':
129             if key == 'min' or key == 'max': continue
130             if key == 'open_session':
131                 if 'pre-vnet-removal-239-g910c152' in commit or 'pre-vnet-removal-240-g9b2fa79' in commit: continue # Broken measurements
132                 if not smp: print 'Testing "Parent protocol open_session performance" in parentperf_open:'
133                 else:       continue
134             else:
135                 if not smp: print 'Testing "Parent protocol call performance" in parentperf_call:'
136                 else:       print 'Testing "Parent protocol call performance (4 CPUs in parallel)" in parentperf_call_smp:'
137             line = line.replace(key, tag+'_'+key);
138             print line
139         continue
140
141     if 'loc.wv' in where:
142         if linetype == 'testing' and 'PASSIVE' in what: line = line.replace('loc.wv', 'loc-passive.wv');
143         if linetype == 'perf' and key != 'files':
144             line = line.replace('ok', 'axis="lines" ok');
145
146     if 'pingpong.wv' in where:
147         if linetype == 'perf':
148             if 'min' in key or 'max' in key: continue
149
150     if 'vancouver-boottime.wv' in where and linetype == 'perf' and key == 'tsc':
151         line = "! PERF: boottime %f s ok" % (val/2.66e9)
152         #print >>sys.stderr, line
153
154     # Output (possibly modified) line
155     print line
156
157 # Local Variables:
158 # compile-command: "make perf"
159 # End: