0ef26c45e242f3b6d2bd94c11320c09634cca7df
[SXSI/xpathcomp.git] / tests / non_regression_tests / sxsi.sh
1 #!/bin/bash
2
3 source utils.sh
4
5 function do_sxsi() {
6     query="$1"
7     doc=`basename "$2" .xml`.srx
8     repeat="$3"
9     TIME_MAT=""
10     TIME_COUNT=""
11     TIME_PRINT=""
12     NUM_RESULTS=""
13     output=`./main.native -r "$3" -c -b "$doc" "$query" 2>&1`
14     echo "$output" >> sxsi_debug.log
15     NUM_RESULT=`echo "$output" | grep "Number of results" | grep -o '[0-9]*'`
16     time=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | cut -f1 -d ':' | grep -o '[0-9.]*'`
17     TIME_COUNT=`echo "$time" | tail -n +2 | average`
18
19     output=`./main.native -b -r "$3" "$doc" "$query" /dev/null 2>&1`
20     mtime=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | cut -f1 -d ':'| grep -o '[0-9.]*'`
21     ptime=`echo "$output" | grep 'Serialization time' | cut -f 3 -d ' ' | grep -o '[0-9.]*'`
22     TIME_MAT=`echo "$mtime" | tail -n +2 | average`
23     TIME_PRINT="$ptime"
24
25     echo "$TIME_COUNT"
26     echo "$TIME_MAT"
27     echo "$TIME_PRINT"
28     echo $NUM_RESULT
29 }
30
31 do_sxsi "$@"