18c2ecf20Sopenharmony_ci#!/bin/bash 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0+ 38c2ecf20Sopenharmony_ci# 48c2ecf20Sopenharmony_ci# Analyze a given results directory for rcuscale scalability measurements. 58c2ecf20Sopenharmony_ci# 68c2ecf20Sopenharmony_ci# Usage: kvm-recheck-rcuscale.sh resdir 78c2ecf20Sopenharmony_ci# 88c2ecf20Sopenharmony_ci# Copyright (C) IBM Corporation, 2016 98c2ecf20Sopenharmony_ci# 108c2ecf20Sopenharmony_ci# Authors: Paul E. McKenney <paulmck@linux.ibm.com> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cii="$1" 138c2ecf20Sopenharmony_ciif test -d "$i" -a -r "$i" 148c2ecf20Sopenharmony_cithen 158c2ecf20Sopenharmony_ci : 168c2ecf20Sopenharmony_cielse 178c2ecf20Sopenharmony_ci echo Unreadable results directory: $i 188c2ecf20Sopenharmony_ci exit 1 198c2ecf20Sopenharmony_cifi 208c2ecf20Sopenharmony_ciPATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH 218c2ecf20Sopenharmony_ci. functions.sh 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciif kvm-recheck-rcuscale-ftrace.sh $i 248c2ecf20Sopenharmony_cithen 258c2ecf20Sopenharmony_ci # ftrace data was successfully analyzed, call it good! 268c2ecf20Sopenharmony_ci exit 0 278c2ecf20Sopenharmony_cifi 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciconfigfile=`echo $i | sed -e 's/^.*\///'` 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cised -e 's/^\[[^]]*]//' < $i/console.log | 328c2ecf20Sopenharmony_ciawk ' 338c2ecf20Sopenharmony_ci/-scale: .* gps: .* batches:/ { 348c2ecf20Sopenharmony_ci ngps = $9; 358c2ecf20Sopenharmony_ci nbatches = $11; 368c2ecf20Sopenharmony_ci} 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/-scale: .*writer-duration/ { 398c2ecf20Sopenharmony_ci gptimes[++n] = $5 / 1000.; 408c2ecf20Sopenharmony_ci sum += $5 / 1000.; 418c2ecf20Sopenharmony_ci} 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ciEND { 448c2ecf20Sopenharmony_ci newNR = asort(gptimes); 458c2ecf20Sopenharmony_ci if (newNR <= 0) { 468c2ecf20Sopenharmony_ci print "No rcuscale records found???" 478c2ecf20Sopenharmony_ci exit; 488c2ecf20Sopenharmony_ci } 498c2ecf20Sopenharmony_ci pct50 = int(newNR * 50 / 100); 508c2ecf20Sopenharmony_ci if (pct50 < 1) 518c2ecf20Sopenharmony_ci pct50 = 1; 528c2ecf20Sopenharmony_ci pct90 = int(newNR * 90 / 100); 538c2ecf20Sopenharmony_ci if (pct90 < 1) 548c2ecf20Sopenharmony_ci pct90 = 1; 558c2ecf20Sopenharmony_ci pct99 = int(newNR * 99 / 100); 568c2ecf20Sopenharmony_ci if (pct99 < 1) 578c2ecf20Sopenharmony_ci pct99 = 1; 588c2ecf20Sopenharmony_ci div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100; 598c2ecf20Sopenharmony_ci print "Histogram bucket size: " div; 608c2ecf20Sopenharmony_ci last = gptimes[1] - 10; 618c2ecf20Sopenharmony_ci count = 0; 628c2ecf20Sopenharmony_ci for (i = 1; i <= newNR; i++) { 638c2ecf20Sopenharmony_ci current = div * int(gptimes[i] / div); 648c2ecf20Sopenharmony_ci if (last == current) { 658c2ecf20Sopenharmony_ci count++; 668c2ecf20Sopenharmony_ci } else { 678c2ecf20Sopenharmony_ci if (count > 0) 688c2ecf20Sopenharmony_ci print last, count; 698c2ecf20Sopenharmony_ci count = 1; 708c2ecf20Sopenharmony_ci last = current; 718c2ecf20Sopenharmony_ci } 728c2ecf20Sopenharmony_ci } 738c2ecf20Sopenharmony_ci if (count > 0) 748c2ecf20Sopenharmony_ci print last, count; 758c2ecf20Sopenharmony_ci print "Average grace-period duration: " sum / newNR " microseconds"; 768c2ecf20Sopenharmony_ci print "Minimum grace-period duration: " gptimes[1]; 778c2ecf20Sopenharmony_ci print "50th percentile grace-period duration: " gptimes[pct50]; 788c2ecf20Sopenharmony_ci print "90th percentile grace-period duration: " gptimes[pct90]; 798c2ecf20Sopenharmony_ci print "99th percentile grace-period duration: " gptimes[pct99]; 808c2ecf20Sopenharmony_ci print "Maximum grace-period duration: " gptimes[newNR]; 818c2ecf20Sopenharmony_ci print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches; 828c2ecf20Sopenharmony_ci print "Computed from rcuscale printk output."; 838c2ecf20Sopenharmony_ci}' 84