From: Andi Kleen <ak@xxxxxxxxxxxxxxx> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx> --- diff-res | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 diff-res diff --git a/diff-res b/diff-res new file mode 100755 index 0000000..90d57be --- /dev/null +++ b/diff-res @@ -0,0 +1,26 @@ +#!/usr/bin/python +# compare two make perf output file +# this should be the results only without any header +import argparse +import math, operator +from collections import OrderedDict + +ap = argparse.ArgumentParser() +ap.add_argument('file1', type=argparse.FileType('r')) +ap.add_argument('file2', type=argparse.FileType('r')) +args = ap.parse_args() + +cmp = (OrderedDict(), OrderedDict()) +for f, k in zip((args.file1, args.file2), cmp): + for j in f: + num = j[59:63] + name = j[:59] + k[name] = float(num) + +for j in cmp[0].keys(): + print j, cmp[1][j] - cmp[0][j] + +def geomean(l): + return math.pow(reduce(operator.mul, filter(lambda x: x != 0.0, l)), 1.0 / len(l)) + +print "geomean %.2f -> %.2f" % (geomean(cmp[0].values()), geomean(cmp[1].values())) -- 2.0.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html