summaryrefslogtreecommitdiff
path: root/test/timing/timeall
blob: cb739a7d2799e4231bc5fba695a9abe9fb841cb5 (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
#!/bin/sh

helpdir="/usr/share/gnome/help/";

title=$1
if [ "x$title" = "x" ]; then
    echo "You must specify a title for the timing run.";
    exit 1;
fi;

mkdir -p "$title";
mkdir -p "$title/_LOGS";
rm -f "$title.times" && touch "$title.times"

for doc in `ls $helpdir`; do
    docdir="$helpdir$doc";
    if [ -d "$docdir" ]; then
	for lang in `ls $docdir`; do
	    langdir="$docdir/$lang";
	    if [ -d "$langdir" ]; then
		docfile="$langdir/$doc.xml";
		outdir="$title/$doc/$lang";
		outfile="$outdir/$doc.xhtml";
		logfile="$title/_LOGS/$doc.$lang.out";
		mkdir -p "$outdir";
		rm -f "$logfile" && touch "$logfile";
		for i in 1 2 3 4 5; do
		    xsltproc --xinclude --timing \
			--stringparam "db.chunk.basename" "$doc" \
			-o "$outfile" \
			../../xslt/docbook/html/db2html.xsl \
			"$docfile" 2>> $logfile;
		done;
		times=`grep 'Running stylesheet and saving result took' \
                    "$logfile" | cut -d' ' -f7 - | sed -e 's/$/+/g'`;
		total=`echo $times 0 | bc`;
		avg=`echo $total / 5 | bc`;
		echo "$doc/$lang  $avg" >> "$title.times";
	    fi;
	done;
    fi;
done;