author | Iain Williamson <iain.williamson@nokia.com> |
Mon, 17 May 2010 18:33:53 +0100 | |
branch | fix |
changeset 560 | 245c03ee6e9c |
parent 528 | f6aa47076e0f |
permissions | -rwxr-xr-x |
88
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
1 |
#!/usr/bin/env python |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
2 |
# |
488 | 3 |
# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
4 |
# All rights reserved. |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
5 |
# This component and the accompanying materials are made available |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
6 |
# under the terms of the License "Eclipse Public License v1.0" |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
7 |
# which accompanies this distribution, and is available |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
8 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
9 |
# |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
10 |
# Initial Contributors: |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
11 |
# Nokia Corporation - initial contribution. |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
12 |
# |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
13 |
# Contributors: |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
14 |
# |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
15 |
# Description: |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
16 |
# |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
17 |
# display summary information about recipes from raptor logs |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
18 |
# e.g. total times and so on. |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
19 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
20 |
import time |
485
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
21 |
import __future__ |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
22 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
23 |
|
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
24 |
|
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
25 |
|
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
26 |
class RecipeStats(object): |
485
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
27 |
def __init__(self, name, count, time): |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
28 |
self.name=name |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
29 |
self.count=count |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
30 |
self.time=time |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
31 |
|
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
32 |
def add(self, duration): |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
33 |
self.time += duration |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
34 |
|
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
35 |
class BuildStats(object): |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
36 |
STAT_OK = 0 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
37 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
38 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
39 |
def __init__(self): |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
40 |
self.stats = {} |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
41 |
self.failcount = 0 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
42 |
self.failtime = 0.0 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
43 |
self.failtypes = {} |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
44 |
self.retryfails = 0 |
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
45 |
self.hosts = {} |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
46 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
47 |
def add(self, starttime, duration, name, status, host, phase): |
485
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
48 |
if status != BuildStats.STAT_OK: |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
49 |
self.failcount += 1 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
50 |
if name in self.failtypes: |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
51 |
self.failtypes[name] += 1 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
52 |
else: |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
53 |
self.failtypes[name] = 1 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
54 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
55 |
if status == 128: |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
56 |
self.retryfails += 1 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
57 |
return |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
58 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
59 |
if name in self.stats: |
485
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
60 |
r = self.stats[name] |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
61 |
r.add(duration) |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
62 |
else: |
485
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
63 |
self.stats[name] = RecipeStats(name,1,duration) |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
64 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
65 |
hp=host |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
66 |
if hp in self.hosts: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
67 |
self.hosts[hp] += 1 |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
68 |
else: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
69 |
self.hosts[hp] = 1 |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
70 |
|
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
71 |
def recipe_csv(self): |
485
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
72 |
s = '"name", "time", "count"\n' |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
73 |
l = sorted(self.stats.values(), key= lambda r: r.time, reverse=True) |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
74 |
for r in l: |
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
75 |
s += '"%s",%s,%d\n' % (r.name, str(r.time), r.count) |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
76 |
return s |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
77 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
78 |
def hosts_csv(self): |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
79 |
s='"host","recipecount"\n' |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
80 |
hs = self.hosts |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
81 |
for h in sorted(hs.keys()): |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
82 |
s += '"%s",%d\n' % (h,hs[h]) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
83 |
return s |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
84 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
85 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
86 |
import sys |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
87 |
import re |
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
88 |
import os |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
89 |
from optparse import OptionParser # for parsing command line parameters |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
90 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
91 |
def main(): |
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
92 |
recipe_re = re.compile(".*<recipe name='([^']+)'.*host='([^']+)'.*") |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
93 |
time_re = re.compile(".*<time start='([0-9]+\.[0-9]+)' *elapsed='([0-9]+\.[0-9]+)'.*") |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
94 |
status_re = re.compile(".*<status exit='(?P<exit>(ok|failed))'( *code='(?P<code>[0-9]+)')?.*") |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
95 |
phase_re = re.compile(".*<info>Making.*?([^\.]+\.[^\.]+)</info>") |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
96 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
97 |
parser = OptionParser(prog = "recipestats", |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
98 |
usage = """%prog --help [-b] [-f <logfilename>]""") |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
99 |
|
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
100 |
parser.add_option("-b","--buildhosts",action="store_true",dest="buildhosts_flag", |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
101 |
help="Lists which build hosts were active in each invocation of the build engine and how many recipes ran on each.", default = False) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
102 |
parser.add_option("-f","--logfile",action="store",dest="logfilename", help="Read from the file, not stdin", default = None) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
103 |
|
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
104 |
|
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
105 |
(options, stuff) = parser.parse_args(sys.argv[1:]) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
106 |
|
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
107 |
if options.logfilename is None: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
108 |
f = sys.stdin |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
109 |
else: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
110 |
f = open(options.logfilename,"r") |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
111 |
|
485
926e968477c6
fix: recipestats.py produces "correct" header line, also sorts by time to show recipe using the largest time first.
timothy.murphy@nokia.com
parents:
100
diff
changeset
|
112 |
st = BuildStats() |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
113 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
114 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
115 |
alternating = 0 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
116 |
start_time = 0.0 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
117 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
118 |
phase=None |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
119 |
for l in f: |
88
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
120 |
l2 = l.rstrip("\n\r") |
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
121 |
|
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
122 |
rm = recipe_re.match(l2) |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
123 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
124 |
if rm is not None: |
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
125 |
(rname,host) = rm.groups() |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
126 |
continue |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
127 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
128 |
pm = phase_re.match(l2) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
129 |
|
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
130 |
if pm is not None: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
131 |
if phase is not None: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
132 |
if options.buildhosts_flag: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
133 |
print('"%s"\n' % phase) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
134 |
print(st.hosts_csv()) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
135 |
st.hosts = {} |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
136 |
phase = pm.groups()[0] |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
137 |
continue |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
138 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
139 |
tm = time_re.match(l2) |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
140 |
if tm is not None: |
88
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
141 |
try: |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
142 |
s = float(tm.groups()[0]) |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
143 |
elapsed = float(tm.groups()[1]) |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
144 |
|
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
145 |
if start_time == 0.0: |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
146 |
start_time = s |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
147 |
|
88
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
148 |
s -= start_time |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
149 |
|
88
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
150 |
continue |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
151 |
except ValueError, e: |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
152 |
raise Exception("Parse problem: float conversion on these groups: %s\n%s" %(str(tm.groups()), str(e))) |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
153 |
else: |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
154 |
if l2.find("<time") is not -1: |
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
155 |
raise Exception("unparsed timing status: %s\n"%l2) |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
156 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
157 |
sm = status_re.match(l2) |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
158 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
159 |
if sm is None: |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
160 |
continue |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
161 |
|
88
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
162 |
if sm.groupdict()['exit'] == 'ok': |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
163 |
status = 0 |
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
164 |
else: |
88
b5820d0f3a1c
Fix errors with parsing exit codes in status tags
timothy.murphy@nokia.com
parents:
87
diff
changeset
|
165 |
status = int(sm.groupdict()['code']) |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
166 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
167 |
st.add(s, elapsed, rname, status, host, phase) |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
168 |
|
528
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
169 |
if options.buildhosts_flag: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
170 |
print('"%s"\n' % phase) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
171 |
print(st.hosts_csv()) |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
172 |
else: |
f6aa47076e0f
allow recipestats to print hosts used in the build.
timothy.murphy@nokia.com
parents:
488
diff
changeset
|
173 |
print(st.recipe_csv()) |
87
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
174 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
175 |
|
01cb4707f979
Added a script for finding out how time each class of recipes took in the build
timothy.murphy@nokia.com
parents:
diff
changeset
|
176 |
if __name__ == '__main__': main() |