diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2016-01-30 19:51:36 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2016-03-31 16:38:57 -0400 |
commit | 2b03d038457fc8d694d34981cb0a2f1702ba35d6 (patch) | |
tree | 801cf48041b05e7c275fff70f124f1cbbfa11c37 /tools | |
parent | ac2bb275e8e5abddb0815ff2b7aa383ed6d007a4 (diff) |
rcutorture: Make scripts analyze rcuperf trace data, if present
The rcuperf event-trace data is more accurate than are the rcuperf
printk()s because locking keeps things ordered. This commit therefore
parses and analyzes this event-trace data if present, and falls back on
the printk()s otherwise.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh | 121 | ||||
-rwxr-xr-x | tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh | 8 |
2 files changed, 129 insertions, 0 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh new file mode 100755 index 000000000000..f79b0e9e84fc --- /dev/null +++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh | |||
@@ -0,0 +1,121 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Analyze a given results directory for rcuperf performance measurements, | ||
4 | # looking for ftrace data. Exits with 0 if data was found, analyzed, and | ||
5 | # printed. Intended to be invoked from kvm-recheck-rcuperf.sh after | ||
6 | # argument checking. | ||
7 | # | ||
8 | # Usage: kvm-recheck-rcuperf-ftrace.sh resdir | ||
9 | # | ||
10 | # This program is free software; you can redistribute it and/or modify | ||
11 | # it under the terms of the GNU General Public License as published by | ||
12 | # the Free Software Foundation; either version 2 of the License, or | ||
13 | # (at your option) any later version. | ||
14 | # | ||
15 | # This program is distributed in the hope that it will be useful, | ||
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | # GNU General Public License for more details. | ||
19 | # | ||
20 | # You should have received a copy of the GNU General Public License | ||
21 | # along with this program; if not, you can access it online at | ||
22 | # http://www.gnu.org/licenses/gpl-2.0.html. | ||
23 | # | ||
24 | # Copyright (C) IBM Corporation, 2016 | ||
25 | # | ||
26 | # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
27 | |||
28 | i="$1" | ||
29 | . tools/testing/selftests/rcutorture/bin/functions.sh | ||
30 | |||
31 | if test "`grep -c 'rcu_exp_grace_period.*start' < $i/console.log`" -lt 100 | ||
32 | then | ||
33 | exit 10 | ||
34 | fi | ||
35 | |||
36 | sed -e 's/^\[[^]]*]//' < $i/console.log | | ||
37 | grep 'us : rcu_exp_grace_period' | | ||
38 | sed -e 's/us : / : /' | | ||
39 | tr -d '\015' | | ||
40 | awk ' | ||
41 | $8 == "start" { | ||
42 | if (starttask != "") | ||
43 | nlost++; | ||
44 | starttask = $1; | ||
45 | starttime = $3; | ||
46 | startseq = $7; | ||
47 | } | ||
48 | |||
49 | $8 == "end" { | ||
50 | if (starttask == $1 && startseq == $7) { | ||
51 | curgpdur = $3 - starttime; | ||
52 | gptimes[++n] = curgpdur; | ||
53 | gptaskcnt[starttask]++; | ||
54 | sum += curgpdur; | ||
55 | if (curgpdur > 1000) | ||
56 | print "Long GP " starttime "us to " $3 "us (" curgpdur "us)"; | ||
57 | starttask = ""; | ||
58 | } else { | ||
59 | # Lost a message or some such, reset. | ||
60 | starttask = ""; | ||
61 | nlost++; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | $8 == "done" { | ||
66 | piggybackcnt[$1]++; | ||
67 | } | ||
68 | |||
69 | END { | ||
70 | newNR = asort(gptimes); | ||
71 | if (newNR <= 0) { | ||
72 | print "No ftrace records found???" | ||
73 | exit 10; | ||
74 | } | ||
75 | pct50 = int(newNR * 50 / 100); | ||
76 | if (pct50 < 1) | ||
77 | pct50 = 1; | ||
78 | pct90 = int(newNR * 90 / 100); | ||
79 | if (pct90 < 1) | ||
80 | pct90 = 1; | ||
81 | pct99 = int(newNR * 99 / 100); | ||
82 | if (pct99 < 1) | ||
83 | pct99 = 1; | ||
84 | div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100; | ||
85 | print "Histogram bucket size: " div; | ||
86 | last = gptimes[1] - 10; | ||
87 | count = 0; | ||
88 | for (i = 1; i <= newNR; i++) { | ||
89 | current = div * int(gptimes[i] / div); | ||
90 | if (last == current) { | ||
91 | count++; | ||
92 | } else { | ||
93 | if (count > 0) | ||
94 | print last, count; | ||
95 | count = 1; | ||
96 | last = current; | ||
97 | } | ||
98 | } | ||
99 | if (count > 0) | ||
100 | print last, count; | ||
101 | print "Distribution of grace periods across tasks:"; | ||
102 | for (i in gptaskcnt) { | ||
103 | print "\t" i, gptaskcnt[i]; | ||
104 | nbatches += gptaskcnt[i]; | ||
105 | } | ||
106 | ngps = nbatches; | ||
107 | print "Distribution of piggybacking across tasks:"; | ||
108 | for (i in piggybackcnt) { | ||
109 | print "\t" i, piggybackcnt[i]; | ||
110 | ngps += piggybackcnt[i]; | ||
111 | } | ||
112 | print "Average grace-period duration: " sum / newNR " microseconds"; | ||
113 | print "Minimum grace-period duration: " gptimes[1]; | ||
114 | print "50th percentile grace-period duration: " gptimes[pct50]; | ||
115 | print "90th percentile grace-period duration: " gptimes[pct90]; | ||
116 | print "99th percentile grace-period duration: " gptimes[pct99]; | ||
117 | print "Maximum grace-period duration: " gptimes[newNR]; | ||
118 | print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches " Lost: " nlost + 0; | ||
119 | print "Computed from ftrace data."; | ||
120 | }' | ||
121 | exit 0 | ||
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh index 1f72df8eedc7..8f3121afc716 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh | |||
@@ -30,8 +30,15 @@ else | |||
30 | echo Unreadable results directory: $i | 30 | echo Unreadable results directory: $i |
31 | exit 1 | 31 | exit 1 |
32 | fi | 32 | fi |
33 | PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH | ||
33 | . tools/testing/selftests/rcutorture/bin/functions.sh | 34 | . tools/testing/selftests/rcutorture/bin/functions.sh |
34 | 35 | ||
36 | if kvm-recheck-rcuperf-ftrace.sh $i | ||
37 | then | ||
38 | # ftrace data was successfully analyzed, call it good! | ||
39 | exit 0 | ||
40 | fi | ||
41 | |||
35 | configfile=`echo $i | sed -e 's/^.*\///'` | 42 | configfile=`echo $i | sed -e 's/^.*\///'` |
36 | 43 | ||
37 | sed -e 's/^\[[^]]*]//' < $i/console.log | | 44 | sed -e 's/^\[[^]]*]//' < $i/console.log | |
@@ -85,4 +92,5 @@ END { | |||
85 | print "99th percentile grace-period duration: " gptimes[pct99]; | 92 | print "99th percentile grace-period duration: " gptimes[pct99]; |
86 | print "Maximum grace-period duration: " gptimes[newNR]; | 93 | print "Maximum grace-period duration: " gptimes[newNR]; |
87 | print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches; | 94 | print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches; |
95 | print "Computed from rcuperf printk output."; | ||
88 | }' | 96 | }' |