1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0+
3#
4# Analyze a given results directory for locktorture progress.
5#
6# Usage: kvm-recheck-lock.sh resdir
7#
8# Copyright (C) IBM Corporation, 2014
9#
10# Authors: Paul E. McKenney <paulmck@linux.ibm.com>
11
12i="$1"
13if test -d "$i" -a -r "$i"
14then
15	:
16else
17	echo Unreadable results directory: $i
18	exit 1
19fi
20
21configfile=`echo $i | sed -e 's/^.*\///'`
22ncs=`grep "Writes:  Total:" $i/console.log 2> /dev/null | tail -1 | sed -e 's/^.* Total: //' -e 's/ .*$//'`
23if test -z "$ncs"
24then
25	echo "$configfile -------"
26else
27	title="$configfile ------- $ncs acquisitions/releases"
28	dur=`grep -v '^#' $i/qemu-cmd | sed -e 's/^.* locktorture.shutdown_secs=//' -e 's/ .*$//' 2> /dev/null`
29	if test -z "$dur"
30	then
31		:
32	else
33		ncsps=`awk -v ncs=$ncs -v dur=$dur '
34			BEGIN { print ncs / dur }' < /dev/null`
35		title="$title ($ncsps per second)"
36	fi
37	echo $title
38fi
39