#!/bin/sh

DBPORT=2200
DBHOST=bigmac.local
DBUSER=lemke/lemke
TABLESET=TS1

CGCLT="../../src/cgclt --server=$DBHOST --port=$DBPORT --tableset=$TABLESET --user=$DBUSER --logfile=clt.log --protocol=serial"

STEP=1000000

$CGCLT --cmd="drop if exists table t1;" > /dev/null
$CGCLT --cmd="create table t1 ( a int, b string(100));" > /dev/null

for i in 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
do
    ../../src/cgblow --mode=insert --server=$DBHOST --port=$DBPORT --iset=i:400000,s:10 --table=t1 --tableset=$TABLESET --user=$DBUSER  --append --interval=10000 --count=$STEP --protocol=serial  > /dev/null
    
   $CGCLT --cmd="drop if exists btree b1;" > /dev/null
   $CGCLT --cmd="create btree b1 on t1(a);" > clt.out 
   NOCACHE=`tail -1 clt.out | awk '{ print $3 }'`
   $CGCLT --cmd="drop if exists btree b1;" > /dev/null
   $CGCLT --cmd="create btree b1 on t1(a) cached;" > clt.out
   CACHE=`tail -1 clt.out | awk '{ print $3 }'`

   NUMTUPLE=`expr $i \* $STEP`  
   echo $NUMTUPLE,$NOCACHE,$CACHE 

done 
