treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / rcutorture / bin / kvm-recheck-rcuperf-ftrace.sh
blob7d3c2be66c64484371f6fc0f0b9c4b6354cbe911
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0+
4 # Analyze a given results directory for rcuperf performance measurements,
5 # looking for ftrace data. Exits with 0 if data was found, analyzed, and
6 # printed. Intended to be invoked from kvm-recheck-rcuperf.sh after
7 # argument checking.
9 # Usage: kvm-recheck-rcuperf-ftrace.sh resdir
11 # Copyright (C) IBM Corporation, 2016
13 # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
15 i="$1"
16 . functions.sh
18 if test "`grep -c 'rcu_exp_grace_period.*start' < $i/console.log`" -lt 100
19 then
20 exit 10
23 sed -e 's/^\[[^]]*]//' < $i/console.log |
24 grep 'us : rcu_exp_grace_period' |
25 sed -e 's/us : / : /' |
26 tr -d '\015' |
27 awk '
28 $8 == "start" {
29 if (startseq != "")
30 nlost++;
31 starttask = $1;
32 starttime = $3;
33 startseq = $7;
34 seqtask[startseq] = starttask;
37 $8 == "end" {
38 if (startseq == $7) {
39 curgpdur = $3 - starttime;
40 gptimes[++n] = curgpdur;
41 gptaskcnt[starttask]++;
42 sum += curgpdur;
43 if (curgpdur > 1000)
44 print "Long GP " starttime "us to " $3 "us (" curgpdur "us)";
45 startseq = "";
46 } else {
47 # Lost a message or some such, reset.
48 startseq = "";
49 nlost++;
53 $8 == "done" && seqtask[$7] != $1 {
54 piggybackcnt[$1]++;
57 END {
58 newNR = asort(gptimes);
59 if (newNR <= 0) {
60 print "No ftrace records found???"
61 exit 10;
63 pct50 = int(newNR * 50 / 100);
64 if (pct50 < 1)
65 pct50 = 1;
66 pct90 = int(newNR * 90 / 100);
67 if (pct90 < 1)
68 pct90 = 1;
69 pct99 = int(newNR * 99 / 100);
70 if (pct99 < 1)
71 pct99 = 1;
72 div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100;
73 print "Histogram bucket size: " div;
74 last = gptimes[1] - 10;
75 count = 0;
76 for (i = 1; i <= newNR; i++) {
77 current = div * int(gptimes[i] / div);
78 if (last == current) {
79 count++;
80 } else {
81 if (count > 0)
82 print last, count;
83 count = 1;
84 last = current;
87 if (count > 0)
88 print last, count;
89 print "Distribution of grace periods across tasks:";
90 for (i in gptaskcnt) {
91 print "\t" i, gptaskcnt[i];
92 nbatches += gptaskcnt[i];
94 ngps = nbatches;
95 print "Distribution of piggybacking across tasks:";
96 for (i in piggybackcnt) {
97 print "\t" i, piggybackcnt[i];
98 ngps += piggybackcnt[i];
100 print "Average grace-period duration: " sum / newNR " microseconds";
101 print "Minimum grace-period duration: " gptimes[1];
102 print "50th percentile grace-period duration: " gptimes[pct50];
103 print "90th percentile grace-period duration: " gptimes[pct90];
104 print "99th percentile grace-period duration: " gptimes[pct99];
105 print "Maximum grace-period duration: " gptimes[newNR];
106 print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches " Lost: " nlost + 0;
107 print "Computed from ftrace data.";
109 exit 0