[BACK]Return to common.dbench CVS log [TXT][DIR] Up to [Development] / xfs-cmds / xfstests

File: [Development] / xfs-cmds / xfstests / common.dbench (download)

Revision 1.6, Tue Jun 29 02:16:00 2004 UTC (13 years, 4 months ago) by fsgqa
Branch: MAIN
Changes since 1.5: +6 -0 lines

Fixed bench marking of other filesystems.
Added error message if dbench is not installed.

##/bin/sh

#check dbench is installed
if [ "`whereis dbench`" == "dbench:"]; then
        echo $0 error dbench not installed.
        exit
fi

_run_dbench()
{
	mkdir ./dbench || exit 1
	cd dbench
	dbench $1
	status=$?
	cd ..
	rm -fr ./dbench
	[ $status -ne 0 ] && exit 1
}

#
# Sample dbench output:
# "Throughput 40.6701 MB/sec (NB=50.8376 MB/sec  406.701 MBit/sec)"
# 

# Output for a single-shot dbench run.
_format_header()
{
	printf "%8s, %s\n" clients MB/sec
}
_filter_dbench()
{
	clients=$1
	perl -ne 'm/Throughput (\S+) MB\/sec/ &&
			{ printf "%8u, %s\n", '$clients', $1 }'
}

# Output for a "multipass" dbench run.
_format_header_multipass()
{
	while [ $# -gt 1 ]; do
		printf "%4s::MB/sec," $1
		shift
	done
	printf "%4s::MB/sec\n" $1
}
_filter_dbench_multipass()
{
	perl -ne '
	if (m/Throughput (\S+) MB\/sec/) {
		$results[$count++] = $1;
	}
	END {	for ($i = 0; $i < $count - 1; $i++) {
			printf "%12.3f,", $results[$i];
		}
		printf "%12.3f\n", $results[$count-1];
	}'
}