14e88ec4aSPaul E. McKenney#!/bin/bash 24e88ec4aSPaul E. McKenney# SPDX-License-Identifier: GPL-2.0+ 34e88ec4aSPaul E. McKenney# 44e88ec4aSPaul E. McKenney# Analyze a given results directory for rcuscale scalability measurements. 54e88ec4aSPaul E. McKenney# 64e88ec4aSPaul E. McKenney# Usage: kvm-recheck-rcuscale.sh resdir 74e88ec4aSPaul E. McKenney# 84e88ec4aSPaul E. McKenney# Copyright (C) IBM Corporation, 2016 94e88ec4aSPaul E. McKenney# 104e88ec4aSPaul E. McKenney# Authors: Paul E. McKenney <paulmck@linux.ibm.com> 114e88ec4aSPaul E. McKenney 124e88ec4aSPaul E. McKenneyi="$1" 134e88ec4aSPaul E. McKenneyif test -d "$i" -a -r "$i" 144e88ec4aSPaul E. McKenneythen 154e88ec4aSPaul E. McKenney : 164e88ec4aSPaul E. McKenneyelse 174e88ec4aSPaul E. McKenney echo Unreadable results directory: $i 184e88ec4aSPaul E. McKenney exit 1 194e88ec4aSPaul E. McKenneyfi 204e88ec4aSPaul E. McKenneyPATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH 214e88ec4aSPaul E. McKenney. functions.sh 224e88ec4aSPaul E. McKenney 234e88ec4aSPaul E. McKenneyif kvm-recheck-rcuscale-ftrace.sh $i 244e88ec4aSPaul E. McKenneythen 254e88ec4aSPaul E. McKenney # ftrace data was successfully analyzed, call it good! 264e88ec4aSPaul E. McKenney exit 0 274e88ec4aSPaul E. McKenneyfi 284e88ec4aSPaul E. McKenney 294e88ec4aSPaul E. McKenneyconfigfile=`echo $i | sed -e 's/^.*\///'` 304e88ec4aSPaul E. McKenney 314e88ec4aSPaul E. McKenneysed -e 's/^\[[^]]*]//' < $i/console.log | 324e88ec4aSPaul E. McKenneyawk ' 334e88ec4aSPaul E. McKenney/-scale: .* gps: .* batches:/ { 344e88ec4aSPaul E. McKenney ngps = $9; 3545c7b962SPaul E. McKenney nbatches = 1; 364e88ec4aSPaul E. McKenney} 374e88ec4aSPaul E. McKenney 384e88ec4aSPaul E. McKenney/-scale: .*writer-duration/ { 394e88ec4aSPaul E. McKenney gptimes[++n] = $5 / 1000.; 404e88ec4aSPaul E. McKenney sum += $5 / 1000.; 414e88ec4aSPaul E. McKenney} 424e88ec4aSPaul E. McKenney 43*1d702e2eSPaul E. McKenney/rcu_scale: Grace-period kthread CPU time/ { 44*1d702e2eSPaul E. McKenney cputime = $6; 45*1d702e2eSPaul E. McKenney} 46*1d702e2eSPaul E. McKenney 474e88ec4aSPaul E. McKenneyEND { 484e88ec4aSPaul E. McKenney newNR = asort(gptimes); 494e88ec4aSPaul E. McKenney if (newNR <= 0) { 504e88ec4aSPaul E. McKenney print "No rcuscale records found???" 514e88ec4aSPaul E. McKenney exit; 524e88ec4aSPaul E. McKenney } 534e88ec4aSPaul E. McKenney pct50 = int(newNR * 50 / 100); 544e88ec4aSPaul E. McKenney if (pct50 < 1) 554e88ec4aSPaul E. McKenney pct50 = 1; 564e88ec4aSPaul E. McKenney pct90 = int(newNR * 90 / 100); 574e88ec4aSPaul E. McKenney if (pct90 < 1) 584e88ec4aSPaul E. McKenney pct90 = 1; 594e88ec4aSPaul E. McKenney pct99 = int(newNR * 99 / 100); 604e88ec4aSPaul E. McKenney if (pct99 < 1) 614e88ec4aSPaul E. McKenney pct99 = 1; 624e88ec4aSPaul E. McKenney div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100; 634e88ec4aSPaul E. McKenney print "Histogram bucket size: " div; 644e88ec4aSPaul E. McKenney last = gptimes[1] - 10; 654e88ec4aSPaul E. McKenney count = 0; 664e88ec4aSPaul E. McKenney for (i = 1; i <= newNR; i++) { 674e88ec4aSPaul E. McKenney current = div * int(gptimes[i] / div); 684e88ec4aSPaul E. McKenney if (last == current) { 694e88ec4aSPaul E. McKenney count++; 704e88ec4aSPaul E. McKenney } else { 714e88ec4aSPaul E. McKenney if (count > 0) 724e88ec4aSPaul E. McKenney print last, count; 734e88ec4aSPaul E. McKenney count = 1; 744e88ec4aSPaul E. McKenney last = current; 754e88ec4aSPaul E. McKenney } 764e88ec4aSPaul E. McKenney } 774e88ec4aSPaul E. McKenney if (count > 0) 784e88ec4aSPaul E. McKenney print last, count; 794e88ec4aSPaul E. McKenney print "Average grace-period duration: " sum / newNR " microseconds"; 804e88ec4aSPaul E. McKenney print "Minimum grace-period duration: " gptimes[1]; 814e88ec4aSPaul E. McKenney print "50th percentile grace-period duration: " gptimes[pct50]; 824e88ec4aSPaul E. McKenney print "90th percentile grace-period duration: " gptimes[pct90]; 834e88ec4aSPaul E. McKenney print "99th percentile grace-period duration: " gptimes[pct99]; 844e88ec4aSPaul E. McKenney print "Maximum grace-period duration: " gptimes[newNR]; 85*1d702e2eSPaul E. McKenney if (cputime != "") 86*1d702e2eSPaul E. McKenney cpustr = " CPU: " cputime; 87*1d702e2eSPaul E. McKenney print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches cpustr; 884e88ec4aSPaul E. McKenney print "Computed from rcuscale printk output."; 894e88ec4aSPaul E. McKenney}' 90