diff options
Diffstat (limited to 'dis/summarize.py')
| -rwxr-xr-x | dis/summarize.py | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/dis/summarize.py b/dis/summarize.py deleted file mode 100755 index 31dcccc..0000000 --- a/dis/summarize.py +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | #!/usr/bin/python3 | ||
| 2 | import sys | ||
| 3 | |||
| 4 | f = sys.argv[1] | ||
| 5 | if len(sys.argv) < 2: | ||
| 6 | print("Usage "+sys.argv[0]+" <filename> --inf-precision") | ||
| 7 | res = {} | ||
| 8 | mem_res = {} | ||
| 9 | memw_res = {} | ||
| 10 | samples = {} | ||
| 11 | max_res = {} | ||
| 12 | |||
| 13 | with open(f) as fp: | ||
| 14 | for line in fp: | ||
| 15 | s = line.split() | ||
| 16 | if s[0] not in res: | ||
| 17 | # print(s[0]) | ||
| 18 | res[s[0]] = list([int(s[5])])#)int(s[5]) | ||
| 19 | mem_res[s[0]] = int(s[8]) | ||
| 20 | memw_res[s[0]] = int(s[9]) | ||
| 21 | samples[s[0]] = int(s[4]) | ||
| 22 | max_res[s[0]] = int(s[5]) | ||
| 23 | else: | ||
| 24 | res[s[0]].append(int(s[5])) | ||
| 25 | mem_res[s[0]] += int(s[8]) | ||
| 26 | memw_res[s[0]] += int(s[9]) | ||
| 27 | max_res[s[0]] = max(int(s[5]), max_res[s[0]]) | ||
| 28 | ## {{{ http://code.activestate.com/recipes/511478/ (r1) | ||
| 29 | import math | ||
| 30 | import functools | ||
| 31 | |||
| 32 | def percentile(N, percent, key=lambda x:x): | ||
| 33 | """ | ||
| 34 | Find the percentile of a list of values. | ||
| 35 | |||
| 36 | @parameter N - is a list of values. Note N MUST BE already sorted. | ||
| 37 | @parameter percent - a float value from 0.0 to 1.0. | ||
| 38 | @parameter key - optional key function to compute value from each element of N. | ||
| 39 | |||
| 40 | @return - the percentile of the values | ||
| 41 | """ | ||
| 42 | if not N: | ||
| 43 | return None | ||
| 44 | k = (len(N)-1) * percent | ||
| 45 | f = math.floor(k) | ||
| 46 | c = math.ceil(k) | ||
| 47 | if f == c: | ||
| 48 | return key(N[int(k)]) | ||
| 49 | d0 = key(N[int(f)]) * (c-k) | ||
| 50 | d1 = key(N[int(c)]) * (k-f) | ||
| 51 | return d0+d1 | ||
| 52 | ## end of http://code.activestate.com/recipes/511478/ }}} | ||
| 53 | avg_max = 0 | ||
| 54 | avg_99th = 0 | ||
| 55 | avg_avg = 0 | ||
| 56 | print("Name\t\tAverage\t\tMax\t\t99th %\t\tAvg Mem Read\tAvg Mem Write\t") | ||
| 57 | for r in sorted(res.keys()): | ||
| 58 | # print(r + "\t\t" + str(res[r]/samples[r]) + "\t\t" + str(max_res[r])) | ||
| 59 | avg_avg += sum(res[r])/len(res[r]) | ||
| 60 | avg_max += max(res[r]) | ||
| 61 | avg_99th += percentile(sorted(res[r]), 0.99) | ||
| 62 | if len(sys.argv) > 2 and sys.argv[2] == "--inf-precision": | ||
| 63 | print("{:12}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}".format(r, sum(res[r])/len(res[r]), max(res[r]), percentile(sorted(res[r]), 0.99), mem_res[r]/samples[r], memw_res[r]/samples[r])) | ||
| 64 | else: | ||
| 65 | print("{:12.12}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}".format(r, sum(res[r])/len(res[r]), max(res[r]), percentile(sorted(res[r]), 0.99), mem_res[r]/samples[r], memw_res[r]/samples[r])) | ||
| 66 | |||
| 67 | print("Average average:", avg_avg/len(res.keys())) | ||
| 68 | print("Average max:", avg_max/len(res.keys())) | ||
| 69 | print("Average 99th:", avg_99th/len(res.keys())) | ||
