aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-07-17 12:48:43 -0400
committerFranklin Wei <me@fwei.tk>2018-07-17 12:48:43 -0400
commitccc71dcb739f6b04740e251cd762ce1628862ae8 (patch)
tree74398a4f0a4da532698a4f978462950d11c54387
parent712cc686d14409a75be3534747828fc0150846a0 (diff)
downloadcsaa-ccc71dcb739f6b04740e251cd762ce1628862ae8.zip
csaa-ccc71dcb739f6b04740e251cd762ce1628862ae8.tar.gz
csaa-ccc71dcb739f6b04740e251cd762ce1628862ae8.tar.bz2
csaa-ccc71dcb739f6b04740e251cd762ce1628862ae8.tar.xz
Change testing procedure, once again
Create is still done 2^logleaves times, but all other operations (modify, retrieve) are done a fixed number of times to speed testing.
-rw-r--r--postprocess.cpp15
-rwxr-xr-xtabulate.sh28
-rwxr-xr-xtestall.sh17
-rwxr-xr-xtestdummy.sh13
-rwxr-xr-xtestmain.sh12
5 files changed, 47 insertions, 38 deletions
diff --git a/postprocess.cpp b/postprocess.cpp
index 1c2dd6f..45a8235 100644
--- a/postprocess.cpp
+++ b/postprocess.cpp
@@ -9,16 +9,16 @@ using namespace std;
/* post-process the output of tabulate.sh */
/* input:
- [x1] [y1_0]
- [x1] [y1_1]
+ [x1] [y1_0] [div1_0]
+ [x1] [y1_1] [div1_1]
...
- [x2] [y2_0]
- [x2] [y2_1]
+ [x2] [y2_0] [div2_0]
+ [x2] [y2_1] [div2_1]
...
[x] is an integer up to 100
*/
/* output:
- [x1] [average y1]/2^[x1] [stderr y1]
+ [x1] [average y1]/[div_n] [stderr y1]
*/
static double values[100][100], sums[100], means[100], stddevs[100], stderrs[100];
@@ -31,9 +31,8 @@ int main()
{
int x;
double y;
- cin >> x >> y;
-
- long long div = 1 << x;
+ unsigned long long div;
+ cin >> x >> y >> div;
values[x][counts[x]] = y / div;
sums[x] += values[x][counts[x]];
diff --git a/tabulate.sh b/tabulate.sh
index c8c22d9..82e6a06 100755
--- a/tabulate.sh
+++ b/tabulate.sh
@@ -1,10 +1,12 @@
#!/bin/bash
+trials=1
+runs_test=10
rm -f all_*.txt dummy_all_*.txt
-for i in `seq 4 20`
+for i in `seq 4 10`
do
- for j in `seq 1 5`
+ for j in `seq 1 1`
do
echo -n "$i $j " >> all_"$i".txt
echo -n "$i $j " >> dummy_all_"$i".txt
@@ -18,30 +20,34 @@ rm -f data_create.txt data_modify.txt data_retrieve.txt data_modifyenc.txt data_
rm -f data_dummy_create.txt data_dummy_modify.txt data_dummy_retrieve.txt
cat all_*.txt | awk '{
+runs_create=lshift(1, $1);
+runs_test='$runs_test';
if(NF >= 5)
- print $1, $5 >> "data_create.txt";
+ print $1, $5, runs_create >> "data_create.txt";
if(NF >= 9)
- print $1, $9 >> "data_modify.txt"
+ print $1, $9, runs_test >> "data_modify.txt"
if(NF >= 13)
- print $1, $13 >> "data_retrieve.txt"
+ print $1, $13, runs_test >> "data_retrieve.txt"
if(NF >= 17)
- print $1, $17 >> "data_modifyenc.txt"
+ print $1, $17, runs_test >> "data_modifyenc.txt"
if(NF >= 21)
- print $1, $21 >> "data_retrieveenc.txt"
+ print $1, $21, runs_test >> "data_retrieveenc.txt"
}'
cat dummy_all_*.txt | awk '{
+runs_create=lshift(1, $1);
+runs_test='$runs_test';
if(NF >= 5)
- print $1, $5 >> "data_dummy_create.txt";
+ print $1, $5, runs_create >> "data_dummy_create.txt";
if(NF >= 9)
- print $1, $9 >> "data_dummy_modify.txt";
+ print $1, $9, runs_test >> "data_dummy_modify.txt";
if(NF >= 13)
- print $1, $13 >> "data_dummy_retrieve.txt";
+ print $1, $13, runs_test >> "data_dummy_retrieve.txt";
}'
for f in data*.txt
do
echo $f
- cat $f | awk '{cmd = "echo " $2 " | ../timetosec.sh"; cmd | getline sec; print $1, sec}' > sec_$f
+ cat $f | awk '{cmd = "echo " $2 " | ../timetosec.sh"; cmd | getline sec; print $1, sec, $3;}' > sec_$f
cat sec_$f | ../postprocess | sort -n > final_$f
done
diff --git a/testall.sh b/testall.sh
index 2c36078..bc9903a 100755
--- a/testall.sh
+++ b/testall.sh
@@ -1,11 +1,12 @@
#!/bin/bash
-if [[ $# -ne 2 ]]
+if [[ $# -ne 3 ]]
then
- echo "Usage: "$0" LOGLEAVES RUNS"
+ echo "Usage: "$0" LOGLEAVES RUNS_CREATE RUNS_TEST"
exit 1
fi
-runs=$2
+runs_create=$2
+runs_test=$3
echo "Initializing..."
rm files -rf
@@ -13,12 +14,12 @@ rm files -rf
./server $1 csaa.db --overwrite > /dev/null &
pid=$!
sleep .2
-/usr/bin/time -v ./testcreate.sh ./client $runs
-/usr/bin/time -v ./testmodify.sh ./client $runs
-/usr/bin/time -v ./testretrieve.sh ./client $runs
-/usr/bin/time -v ./testmodifyenc.sh ./client $runs
+/usr/bin/time -v ./testcreate.sh ./client $runs_create
+/usr/bin/time -v ./testmodify.sh ./client $runs_test
+/usr/bin/time -v ./testretrieve.sh ./client $runs_test
+/usr/bin/time -v ./testmodifyenc.sh ./client $runs_test
echo "Encrypted retrieve: "
-/usr/bin/time -v ./testretrieve.sh ./client $runs
+/usr/bin/time -v ./testretrieve.sh ./client $runs_test
kill -SIGINT $!
rm csaa.db
diff --git a/testdummy.sh b/testdummy.sh
index fc2ee64..4f4940b 100755
--- a/testdummy.sh
+++ b/testdummy.sh
@@ -1,11 +1,12 @@
#!/bin/bash
-if [[ $# -ne 2 ]]
+if [[ $# -ne 3 ]]
then
- echo "Usage: "$0" LOGLEAVES RUNS"
+ echo "Usage: "$0" LOGLEAVES RUNS_CREATE RUNS_TEST"
exit 1
fi
-runs=$2
+runs_create=$2
+runs_test=$3
echo "Initializing dummy..."
rm files -rf
@@ -13,8 +14,8 @@ rm files -rf
./dummy_server $1 csaa.db --overwrite > /dev/null &
pid=$!
sleep .2
-/usr/bin/time -v ./testcreate.sh ./dummy_client $runs
-/usr/bin/time -v ./testmodify.sh ./dummy_client $runs
-/usr/bin/time -v ./testretrieve.sh ./dummy_client $runs
+/usr/bin/time -v ./testcreate.sh ./dummy_client $runs_create
+/usr/bin/time -v ./testmodify.sh ./dummy_client $runs_test
+/usr/bin/time -v ./testretrieve.sh ./dummy_client $runs_test
kill -SIGINT $!
rm csaa.db
diff --git a/testmain.sh b/testmain.sh
index 9776f4f..c5d2c1d 100755
--- a/testmain.sh
+++ b/testmain.sh
@@ -1,22 +1,24 @@
#!/bin/bash
mkdir -p results
-trials=5
+trials=1
+runs_test=10
-for i in `seq 4 20`
+# minimum is ceil(lg(runs_test)), otherwise modify will fail
+for i in `seq 4 10`
do
echo "logleaves "$i
- runs=$(echo '2^'"$i" | bc)
+ runs_create=$(echo '2^'"$i" | bc)
echo "Doing "$trials"x"$runs" operations"
for j in $(seq 1 $trials)
do
- ./testall.sh $i $runs 2> results/run_"$i"_"$j".txt
+ ./testall.sh $i $runs_create $runs_test 2> results/run_"$i"_"$j".txt
sleep .2
# dummy
- ./testdummy.sh $i $runs 2> results/dummy_"$i"_"$j".txt
+ ./testdummy.sh $i $runs_create $runs_test 2> results/dummy_"$i"_"$j".txt
sleep .2
done
done