distribution.sh 861 Bytes
Newer Older
Sylvain Schmitz's avatar
Sylvain Schmitz committed
1
#!/bin/bash
2 3
# count the number of queries of each size
# argument: the size of blocks of queries, 1 by default
Sylvain Schmitz's avatar
Sylvain Schmitz committed
4

5 6 7 8 9 10
if [ "$#" -ne 1 ]
then
    step=1
else
    step=$1
fi
11 12
if [ x${FRAGTYPE}x = xx ] ; then FRAGTYPE='xslt\|xquery' ; fi
fragments=`grep 'type="\('${FRAGTYPE}'\)"' benchmarks-all-full.xml | sed -e 's/.*href="\([^"]*\).*/\1/'`
Sylvain Schmitz's avatar
Sylvain Schmitz committed
13 14
MAX=`grep 'MAX_AST_SIZE =' ../../src/main/java/fr/lsv/xpparser/XPathEntry.java| sed -e 's/[^0-9]*\([0-9]*\).*/\1/'`

Sylvain Schmitz's avatar
Sylvain Schmitz committed
15 16 17
numqueries=`cat numqueries`
half=$((numqueries / 2))
total=0
18
for ((i = 1; i < $MAX; i+=$step))
Sylvain Schmitz's avatar
Sylvain Schmitz committed
19
do
20 21 22 23 24 25
    C=0
    for ((j = $i; j < $i+$step; ++j))
    do
        G=`grep "ast depth=.* size=\"$j\"" $fragments | wc -l`
        C=$((C + G))
    done
Sylvain Schmitz's avatar
Sylvain Schmitz committed
26 27 28 29 30 31 32
    total=$((C + total))
    if [ "$total" -gt "$half" ]
    then
        printf "%'.0f" $i > median.tex
        half=$numqueries
    fi
    echo "$i $C $total"
Sylvain Schmitz's avatar
Sylvain Schmitz committed
33 34
done