Linux 4.8-rc8
[linux/fpc-iii.git] / tools / testing / selftests / rcutorture / bin / kvm-recheck-rcuperf.sh
blob8f3121afc716d4d5e0295b501d76bb9e662d76d8
1 #!/bin/bash
3 # Analyze a given results directory for rcuperf performance measurements.
5 # Usage: kvm-recheck-rcuperf.sh resdir
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.
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.
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.
21 # Copyright (C) IBM Corporation, 2016
23 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
25 i="$1"
26 if test -d $i
27 then
29 else
30 echo Unreadable results directory: $i
31 exit 1
33 PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH
34 . tools/testing/selftests/rcutorture/bin/functions.sh
36 if kvm-recheck-rcuperf-ftrace.sh $i
37 then
38 # ftrace data was successfully analyzed, call it good!
39 exit 0
42 configfile=`echo $i | sed -e 's/^.*\///'`
44 sed -e 's/^\[[^]]*]//' < $i/console.log |
45 awk '
46 /-perf: .* gps: .* batches:/ {
47 ngps = $9;
48 nbatches = $11;
51 /-perf: .*writer-duration/ {
52 gptimes[++n] = $5 / 1000.;
53 sum += $5 / 1000.;
56 END {
57 newNR = asort(gptimes);
58 if (newNR <= 0) {
59 print "No rcuperf records found???"
60 exit;
62 pct50 = int(newNR * 50 / 100);
63 if (pct50 < 1)
64 pct50 = 1;
65 pct90 = int(newNR * 90 / 100);
66 if (pct90 < 1)
67 pct90 = 1;
68 pct99 = int(newNR * 99 / 100);
69 if (pct99 < 1)
70 pct99 = 1;
71 div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100;
72 print "Histogram bucket size: " div;
73 last = gptimes[1] - 10;
74 count = 0;
75 for (i = 1; i <= newNR; i++) {
76 current = div * int(gptimes[i] / div);
77 if (last == current) {
78 count++;
79 } else {
80 if (count > 0)
81 print last, count;
82 count = 1;
83 last = current;
86 if (count > 0)
87 print last, count;
88 print "Average grace-period duration: " sum / newNR " microseconds";
89 print "Minimum grace-period duration: " gptimes[1];
90 print "50th percentile grace-period duration: " gptimes[pct50];
91 print "90th percentile grace-period duration: " gptimes[pct90];
92 print "99th percentile grace-period duration: " gptimes[pct99];
93 print "Maximum grace-period duration: " gptimes[newNR];
94 print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches;
95 print "Computed from rcuperf printk output.";