| 1 | #! /bin/sh |
| 2 | # |
| 3 | # $Id$ |
| 4 | |
| 5 | # Use our pathname to locate the absolute path for our awk scripts. |
| 6 | t=`dirname $0` |
| 7 | h=`(cd $t && echo $PWD)` |
| 8 | |
| 9 | # We need a temporary file, and we need to clean it up after failure. |
| 10 | tmp="$PWD/__t" |
| 11 | trap 'rm -f $tmp; exit 1' 1 2 3 13 15 |
| 12 | trap 'rm -f $tmp; exit 0' 0 |
| 13 | |
| 14 | # header -- |
| 15 | # Output HTML page header. |
| 16 | # $1: directory name. |
| 17 | header() |
| 18 | { |
| 19 | echo "<html>" |
| 20 | echo "<head>" |
| 21 | machine=`echo $1 | sed 's/.*\.//'` |
| 22 | echo "<title>Berkeley DB test_micro run: $machine</title>" |
| 23 | echo "</head>" |
| 24 | echo "<body bgcolor=white>" |
| 25 | echo "<center><h1>Berkeley DB test_micro run: $machine</h1></center>" |
| 26 | echo "<p align=right>`date`</p>" |
| 27 | test -f UNAME && cat UNAME |
| 28 | } |
| 29 | |
| 30 | # footer -- |
| 31 | # Output HTML page footer. |
| 32 | footer() |
| 33 | { |
| 34 | echo "</body>" |
| 35 | echo "</html>" |
| 36 | } |
| 37 | |
| 38 | # table -- |
| 39 | # Create a table. |
| 40 | # $1: output file |
| 41 | table() |
| 42 | { |
| 43 | title="Test $1: `egrep '^#' $1 | sort -u | sed 's/^#[ ]*//'`" |
| 44 | echo "<hr size=1 noshade>" |
| 45 | echo "<table cellspacing=0 cellpadding=0 border=0>" |
| 46 | echo "<th align=left colspan=2>$title</th>" |
| 47 | echo "<tr>" |
| 48 | echo "<th align=right>Release</th>" |
| 49 | echo "<th align=center>Operations/second</th>" |
| 50 | echo "</tr>" |
| 51 | |
| 52 | # You can set the MAJOR and MINOR environment variables to limit |
| 53 | # the BDB releases for which a report is created. |
| 54 | # |
| 55 | # Process the output into a single line per release. |
| 56 | egrep "^${MAJOR:-[0-9][0-9]*}.${MINOR:-*}" $1 | |
| 57 | awk -f $h/report.awk | |
| 58 | sort -n > $tmp |
| 59 | |
| 60 | # Get the release count, and maximum value. |
| 61 | nrel=`wc -l $tmp` |
| 62 | max=`sort -k 2 -n -t ":" < $tmp | tail -1 | awk -F: '{print $2}'` |
| 63 | |
| 64 | # Display the output. |
| 65 | IFS=":" |
| 66 | cat $tmp | while true; do |
| 67 | # release, average, runs, percent, standard deviation |
| 68 | read rel avg runs percent rsd |
| 69 | if test "X$rel" = "X" ; then |
| 70 | break; |
| 71 | fi |
| 72 | |
| 73 | # echo "read: rel $rel, avg $avg, runs $runs, percent $percent, rsd $rsd" > /dev/stderr |
| 74 | |
| 75 | echo "<tr>" |
| 76 | echo "<td align=right width=80><pre>$rel</pre></td>" |
| 77 | echo "<td>" |
| 78 | echo "<table>" |
| 79 | echo "<tr>" |
| 80 | if [ "$max" = "0.00" ];then |
| 81 | t=0 |
| 82 | else |
| 83 | t=`echo "400 * ($avg/($max + $max/10))" | bc -l` |
| 84 | fi |
| 85 | t=`printf %.0f $t` |
| 86 | echo "<td bgcolor='#003366' width=$t> </td>" |
| 87 | t=`echo "400 - $t" | bc` |
| 88 | echo "<td bgcolor='#CCCCCC' width=$t> </td>" |
| 89 | echo "<td> </td>" |
| 90 | echo "<td align=right width=100><pre>$avg</pre></td>" |
| 91 | if test "X$percent" != "X" -o "X$rsd" != "X"; then |
| 92 | echo -n "<td align=right><pre> (" |
| 93 | if test "X$percent" = "X"; then |
| 94 | echo -n '***' |
| 95 | else |
| 96 | echo -n "-$percent" |
| 97 | fi |
| 98 | if test "X$rsd" != "X"; then |
| 99 | echo -n ", $rsd rsd, $runs runs" |
| 100 | fi |
| 101 | echo ")</pre></td>" |
| 102 | fi |
| 103 | echo "</tr>" |
| 104 | echo "</table>" |
| 105 | echo "</tr>" |
| 106 | done |
| 107 | echo "</table>" |
| 108 | } |
| 109 | |
| 110 | for i in RUN.*; do |
| 111 | echo "Building $i..." |
| 112 | name=`echo $i | sed 's/RUN.//'` |
| 113 | (cd $i |
| 114 | header $i |
| 115 | for j in `ls [0-9]* | sort -n`; do |
| 116 | table $j |
| 117 | done |
| 118 | footer) > $i/$name.html |
| 119 | done |
| 120 | |
| 121 | exit 0 |