72 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.0+3#4# Analyze a given results directory for refscale performance measurements.5#6# Usage: kvm-recheck-refscale.sh resdir7#8# Copyright (C) IBM Corporation, 20169#10# Authors: Paul E. McKenney <paulmck@linux.ibm.com>11 12i="$1"13if test -d "$i" -a -r "$i"14then15 :16else17 echo Unreadable results directory: $i18 exit 119fi20PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH21. functions.sh22 23configfile=`echo $i | sed -e 's/^.*\///'`24 25sed -e 's/^\[[^]]*]//' < $i/console.log | tr -d '\015' |26awk -v configfile="$configfile" '27/^[ ]*Runs Time\(ns\) *$/ {28 if (dataphase + 0 == 0) {29 dataphase = 1;30 # print configfile, $0;31 }32 next;33}34 35/[^ ]*[0-9][0-9]* [0-9][0-9]*\.[0-9][0-9]*$/ {36 if (dataphase == 1) {37 # print $0;38 readertimes[++n] = $2;39 sum += $2;40 }41 next;42}43 44{45 if (dataphase == 1)46 dataphase == 2;47 next;48}49 50END {51 print configfile " results:";52 newNR = asort(readertimes);53 if (newNR <= 0) {54 print "No refscale records found???"55 exit;56 }57 medianidx = int(newNR / 2);58 if (newNR == medianidx * 2)59 medianvalue = (readertimes[medianidx - 1] + readertimes[medianidx]) / 2;60 else61 medianvalue = readertimes[medianidx];62 points = "Points:";63 for (i = 1; i <= newNR; i++)64 points = points " " readertimes[i];65 print points;66 print "Average reader duration: " sum / newNR " nanoseconds";67 print "Minimum reader duration: " readertimes[1];68 print "Median reader duration: " medianvalue;69 print "Maximum reader duration: " readertimes[newNR];70 print "Computed from refscale printk output.";71}'72