Re: [PATCH 5/5] Add a little script to compare two make perf runs
- From
Bert Wesarg <bert.wesarg@googlemail.com>
- Date
- Jul 6, 2014, 16:12 UTC
- Message-ID
- <CAKPyHN3rz+TUkcpAS3151XZo+zK2Un=LOrQ_A=TVo4QQ_EUsDg@mail.gmail.com>
- In-Reply-To
- <1404517432-25185-6-git-send-email-andi@firstfloor.org>
Hi,
On Sat, Jul 5, 2014 at 1:43 AM, Andi Kleen <andi@firstfloor.org> wrote:
Show 40 quoted lines
> From: Andi Kleen <ak@linux.intel.com>
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
> 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()))a justification why the geometric mean is used here would increase my confident significantly.
It calculates wrong values anyway iff there are zeros in the sampling set.
Thanks.
Bert