OLD | NEW |
(Empty) | |
| 1 from collections import defaultdict |
| 2 import re |
| 3 |
| 4 f = open("mac_same.txt") |
| 5 field = 'media_bitrate' |
| 6 |
| 7 sum_x = defaultdict(float) |
| 8 sum_xx = defaultdict(float) |
| 9 cnt = defaultdict(int) |
| 10 |
| 11 for line in f: |
| 12 line = line.strip() |
| 13 if line.startswith('[ RUN'): |
| 14 test = line[line.find('.') + 1:-2] |
| 15 if line.startswith('RESULT ' + field): |
| 16 avg = re.search('([\d.]+)', line) |
| 17 avg = float(avg.group(1)) |
| 18 sum_x[test] += avg |
| 19 sum_xx[test] += avg * avg |
| 20 cnt[test] += 1 |
| 21 |
| 22 f.close() |
| 23 |
| 24 for test in sorted(sum_x.keys()): |
| 25 avg_x = sum_x[test] / cnt[test] |
| 26 avg_xx = sum_xx[test] / cnt[test] |
| 27 print "{:43} {:.1f} +- {:.1f} (n={})".format( |
| 28 test, avg_x, (avg_xx - avg_x * avg_x) ** 0.5, cnt[test]) |
| 29 |
| 30 def show_change(test_prefix): |
| 31 master = sum_x[test_prefix + '_Master'] |
| 32 mod = sum_x[test_prefix + '_Mod'] |
| 33 before = sum_x[test_prefix + '_Before'] |
| 34 print "{:30} master: {:4.1f}% mod: {:4.1f}".format( |
| 35 test_prefix, |
| 36 (master / before - 1.) * 100, |
| 37 (mod / before - 1.) * 100) |
| 38 |
| 39 print |
| 40 print "Increase after the new patch:" |
| 41 show_change('ScreenshareSlidesVP8_2TL') |
OLD | NEW |