summaryrefslogtreecommitdiff
path: root/db-4.8.30/test_micro/report
blob: c7358dbc165aebd2e5c6e52eb989dbcc2cf1b59b (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#! /bin/sh
#
# $Id$

# Use our pathname to locate the absolute path for our awk scripts.
t=`dirname $0`
h=`(cd $t && echo $PWD)`

# We need a temporary file, and we need to clean it up after failure.
tmp="$PWD/__t"
trap 'rm -f $tmp; exit 1' 1 2 3 13 15
trap 'rm -f $tmp; exit 0' 0

# header --
#	Output HTML page header.
#	$1: directory name.
header()
{
	echo "<html>"
	echo "<head>"
	machine=`echo $1 | sed 's/.*\.//'`
	echo "<title>Berkeley DB test_micro run: $machine</title>"
	echo "</head>"
	echo "<body bgcolor=white>"
	echo "<center><h1>Berkeley DB test_micro run: $machine</h1></center>"
	echo "<p align=right>`date`</p>"
	test -f UNAME && cat UNAME
}

# footer --
#	Output HTML page footer.
footer()
{
	echo "</body>"
	echo "</html>"
}

# table --
#	Create a table.
#	$1: output file
table()
{
	title="Test $1: `egrep '^#' $1 | sort -u | sed 's/^#[	 ]*//'`"
	echo "<hr size=1 noshade>"
	echo "<table cellspacing=0 cellpadding=0 border=0>"
	echo "<th align=left colspan=2>$title</th>"
	echo "<tr>"
	echo "<th align=right>Release</th>"
	echo "<th align=center>Operations/second</th>"
	echo "</tr>"

	# You can set the MAJOR and MINOR environment variables to limit
	# the BDB releases for which a report is created.
	#
	# Process the output into a single line per release.
	egrep "^${MAJOR:-[0-9][0-9]*}.${MINOR:-*}" $1 |
	awk -f $h/report.awk |
	sort -n > $tmp

	# Get the release count, and maximum value.
	nrel=`wc -l $tmp`
	max=`sort -k 2 -n -t ":" < $tmp | tail -1 | awk -F: '{print $2}'`

	# Display the output.
	IFS=":"
	cat $tmp | while true; do
		# release, average, runs, percent, standard deviation
		read rel avg runs percent rsd
		if test "X$rel" = "X" ; then
			break;
		fi

		# echo "read: rel $rel, avg $avg, runs $runs, percent $percent, rsd $rsd" > /dev/stderr

		echo "<tr>"
		echo "<td align=right width=80><pre>$rel</pre></td>"
		echo "<td>"
		echo "<table>"
		echo "<tr>"
		if [ "$max" = "0.00" ];then
			t=0
		else
			t=`echo "400 * ($avg/($max + $max/10))" | bc -l`
		fi
		t=`printf %.0f $t`
		echo "<td bgcolor='#003366' width=$t>&nbsp;</td>"
		t=`echo "400 - $t" | bc`
		echo "<td bgcolor='#CCCCCC' width=$t>&nbsp;</td>"
		echo "<td>&nbsp;&nbsp;</td>"
		echo "<td align=right width=100><pre>$avg</pre></td>"
		if test "X$percent" != "X" -o "X$rsd" != "X"; then
			echo -n "<td align=right><pre>&nbsp;&nbsp;("
			if test "X$percent" = "X"; then
				echo -n '***'
			else
				echo -n "-$percent"
			fi
			if test "X$rsd" != "X"; then
				echo -n ", $rsd rsd, $runs runs"
			fi
			echo ")</pre></td>"
		fi
		echo "</tr>"
		echo "</table>"
		echo "</tr>"
	done
	echo "</table>"
}

for i in RUN.*; do
	echo "Building $i..."
	name=`echo $i | sed 's/RUN.//'`
	(cd $i
	header $i
	for j in `ls [0-9]* | sort -n`; do
		table $j
	done
	footer) > $i/$name.html
done

exit 0