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
9 # Usage: kvm-recheck-rcuperf-ftrace.sh resdir
11 # Copyright (C) IBM Corporation, 2016
13 # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
18 if test "`grep -c 'rcu_exp_grace_period.*start' < $i/console.log`" -lt 100
23 sed -e 's/^\[[^]]*]//' < $i/console.log |
24 grep 'us : rcu_exp_grace_period' |
25 sed -e 's/us : / : /' |
34 seqtask[startseq] = starttask;
39 curgpdur = $3 - starttime;
40 gptimes[++n] = curgpdur;
41 gptaskcnt[starttask]++;
44 print "Long GP " starttime "us to " $3 "us (" curgpdur "us)";
47 # Lost a message or some such, reset.
53 $8 == "done" && seqtask[$7] != $1 {
58 newNR = asort(gptimes);
60 print "No ftrace records found???"
63 pct50 = int(newNR * 50 / 100);
66 pct90 = int(newNR * 90 / 100);
69 pct99 = int(newNR * 99 / 100);
72 div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100;
73 print "Histogram bucket size: " div;
74 last = gptimes[1] - 10;
76 for (i = 1; i <= newNR; i++) {
77 current = div * int(gptimes[i] / div);
78 if (last == current) {
89 print "Distribution of grace periods across tasks:";
90 for (i in gptaskcnt) {
91 print "\t" i, gptaskcnt[i];
92 nbatches += gptaskcnt[i];
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.";