Show More
@@ -145,22 +145,30 b' def formatfactor(factor):' | |||||
145 | factor //= 0 |
|
145 | factor //= 0 | |
146 | return 'x%ix%i' % (factor, order) |
|
146 | return 'x%ix%i' % (factor, order) | |
147 |
|
147 | |||
|
148 | def formattiming(value): | |||
|
149 | """format a value to strictly 8 char, dropping some precision if needed""" | |||
|
150 | if value < 10**7: | |||
|
151 | return ('%.6f' % value)[:8] | |||
|
152 | else: | |||
|
153 | # value is HUGE very unlikely to happen (4+ month run) | |||
|
154 | return '%i' % value | |||
|
155 | ||||
148 | _marker = object() |
|
156 | _marker = object() | |
149 | def printresult(variants, idx, data, maxidx, verbose=False, reference=_marker): |
|
157 | def printresult(variants, idx, data, maxidx, verbose=False, reference=_marker): | |
150 | """print a line of result to stdout""" |
|
158 | """print a line of result to stdout""" | |
151 | mask = '%%0%ii) %%s' % idxwidth(maxidx) |
|
159 | mask = '%%0%ii) %%s' % idxwidth(maxidx) | |
152 | out = [] |
|
160 | out = [] | |
153 | for var in variants: |
|
161 | for var in variants: | |
154 |
out.append( |
|
162 | out.append(formattiming(data[var]['wall'])) | |
155 | if reference is not _marker: |
|
163 | if reference is not _marker: | |
156 | factor = None |
|
164 | factor = None | |
157 | if reference is not None: |
|
165 | if reference is not None: | |
158 | factor = getfactor(reference[var], data[var], 'wall') |
|
166 | factor = getfactor(reference[var], data[var], 'wall') | |
159 | out.append(formatfactor(factor)) |
|
167 | out.append(formatfactor(factor)) | |
160 | if verbose: |
|
168 | if verbose: | |
161 |
out.append( |
|
169 | out.append(formattiming(data[var]['comb'])) | |
162 |
out.append( |
|
170 | out.append(formattiming(data[var]['user'])) | |
163 |
out.append( |
|
171 | out.append(formattiming(data[var]['sys'])) | |
164 | out.append('%6d' % data[var]['count']) |
|
172 | out.append('%6d' % data[var]['count']) | |
165 | print mask % (idx, ' '.join(out)) |
|
173 | print mask % (idx, ' '.join(out)) | |
166 |
|
174 | |||
@@ -169,13 +177,15 b' def printheader(variants, maxidx, verbos' | |||||
169 | for var in variants: |
|
177 | for var in variants: | |
170 | if not var: |
|
178 | if not var: | |
171 | var = 'iter' |
|
179 | var = 'iter' | |
172 | header.append(' %-8s' % var) |
|
180 | if 8 < len(var): | |
|
181 | var = var[:3] + '..' + var[-3:] | |||
|
182 | header.append('%-8s' % var) | |||
173 | if relative: |
|
183 | if relative: | |
174 | header.append(' ') |
|
184 | header.append(' ') | |
175 | if verbose: |
|
185 | if verbose: | |
176 |
header.append(' |
|
186 | header.append('%-8s' % 'comb') | |
177 |
header.append(' |
|
187 | header.append('%-8s' % 'user') | |
178 |
header.append(' |
|
188 | header.append('%-8s' % 'sys') | |
179 | header.append('%6s' % 'count') |
|
189 | header.append('%6s' % 'count') | |
180 | print ' '.join(header) |
|
190 | print ' '.join(header) | |
181 |
|
191 |
General Comments 0
You need to be logged in to leave comments.
Login now