summaryrefslogtreecommitdiff
path: root/common.dbench
blob: f4d7d151458a64e0b031e211fad152e8cc196f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
##/bin/sh

_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];
	}'
}