]> git.karo-electronics.de Git - karo-tx-linux.git/blob - tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh
rcutorture: Update scripting to accommodate rcuperf
[karo-tx-linux.git] / tools / testing / selftests / rcutorture / bin / kvm-recheck-rcuperf.sh
1 #!/bin/bash
2 #
3 # Analyze a given results directory for rcuperf performance measurements.
4 #
5 # Usage: kvm-recheck-rcuperf.sh resdir
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, you can access it online at
19 # http://www.gnu.org/licenses/gpl-2.0.html.
20 #
21 # Copyright (C) IBM Corporation, 2016
22 #
23 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
24
25 i="$1"
26 if test -d $i
27 then
28         :
29 else
30         echo Unreadable results directory: $i
31         exit 1
32 fi
33 . tools/testing/selftests/rcutorture/bin/functions.sh
34
35 configfile=`echo $i | sed -e 's/^.*\///'`
36
37 grep -e '-perf:.*writer-duration' $i/console.log | sed -e 's/^\[[^]]*]//' |
38 awk '
39 {
40         gptimes[++n] = $5 / 1000.;
41         sum += $5 / 1000.;
42 }
43
44 END {
45         if (NR <= 0) {
46                 print "No rcuperf records found???"
47                 exit;
48         }
49         asort(gptimes);
50         pct50 = int(NR * 50 / 100);
51         if (pct50 < 1)
52                 pct50 = 1;
53         pct90 = int(NR * 90 / 100);
54         if (pct90 < 1)
55                 pct90 = 1;
56         pct99 = int(NR * 99 / 100);
57         if (pct99 < 1)
58                 pct99 = 1;
59         div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100;
60         print "Histogram bucket size: " div;
61         last = gptimes[1] - 10;
62         count = 0;
63         for (i = 1; i <= NR; i++) {
64                 current = div * int(gptimes[i] / div);
65                 if (last == current) {
66                         count++;
67                 } else {
68                         if (count > 0)
69                                 print last, count;
70                         count = 1;
71                         last = current;
72                 }
73         }
74         if (count > 0)
75                 print last, count;
76         print "Average grace-period duration: " sum / NR " microseconds";
77         print "Minimum grace-period duration: " gptimes[1];
78         print "50th percentile grace-period duration: " gptimes[pct50];
79         print "90th percentile grace-period duration: " gptimes[pct90];
80         print "99th percentile grace-period duration: " gptimes[pct99];
81         print "Maximum grace-period duration: " gptimes[NR];
82 }'