diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-08-04 10:12:41 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-08-04 10:12:41 -0700 |
commit | 7eb16a55503855d65c49b0a7e356a317c1325515 (patch) | |
tree | fc49ede3045ca98385d3cc6a2615320d2489e621 /benchmark/getgraphs.py | |
parent | 946dcf4a5d9e35046eb4c2bd4c31e2d4633199e0 (diff) |
Beginnings of a more extensive benchmarking suite.
Diffstat (limited to 'benchmark/getgraphs.py')
-rw-r--r-- | benchmark/getgraphs.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/benchmark/getgraphs.py b/benchmark/getgraphs.py new file mode 100644 index 0000000..392b6ef --- /dev/null +++ b/benchmark/getgraphs.py @@ -0,0 +1,35 @@ + +import sys + +benchmarks = {} +color_map = {'proto2_compiled': 'FF0000', + 'proto2_table': 'FF00FF', + 'upb_table_byref': '0000FF', + 'upb_table_byval': '00FF00'} +for line in sys.stdin: + name, val = line.split(': ') + components = name.split('_') + benchmark = '_'.join(components[1:3]) + variant = '_'.join(components[3:]) + if benchmark not in benchmarks: + benchmarks[benchmark] = [] + benchmarks[benchmark].append((variant, int(val))) + +def encode(x): + digits = (range(ord("A"), ord("Z")+1) + range(ord("a"), ord("z")+1) + + range(ord("0"), ord("9")+1) + [ord("."), ord("-")]) + return chr(digits[x / 64]) + chr(digits[x % 64]) + +for benchmark, values in benchmarks.items(): + def cmp(a, b): + return b[1] - a[1] + values.sort(cmp) + variants = [x[0] for x in values] + values = [x[1] for x in values] + scaling = 300 + encoded_values = [encode((x * 4096 / scaling) - 1) for x in values] + legend = "chdl=%s" % ("|".join(variants)) + colors = "chco=%s" % ("|".join([color_map[x] for x in variants])) + data = "chd=e:%s" % ("".join(encoded_values)) + url = "http://chart.apis.google.com/chart?cht=bhs&chs=500x200&chtt=%s+(MB/s)&chxt=x&chxr=0,0,%d&%s" % (benchmark, scaling, "&".join([legend, data, colors])) + print url |