aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/perf_scalarproduct.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalarproduct/perf_scalarproduct.sh')
-rwxr-xr-xsrc/scalarproduct/perf_scalarproduct.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/scalarproduct/perf_scalarproduct.sh b/src/scalarproduct/perf_scalarproduct.sh
new file mode 100755
index 000000000..35a6d872c
--- /dev/null
+++ b/src/scalarproduct/perf_scalarproduct.sh
@@ -0,0 +1,43 @@
1#!/bin/bash
2# compute a simple scalar product
3# payload for this test:
4SIZE=1000
5INPUTALICE="-k CCC -e '"
6INPUTBOB="-k CCC -e '"
7for X in `seq 1 $SIZE`
8do
9 INPUTALICE="${INPUTALICE}A${X},$X;"
10 INPUTBOB="${INPUTBOB}A${X},$X;"
11done
12INPUTALICE="${INPUTALICE}BC,-20000;RO,1000;FL,100;LOL,24;'"
13INPUTBOB="${INPUTBOB}AB,10;RO,3;FL,3;LOL,-1;'"
14
15# necessary to make the testing prefix deterministic, so we can access the config files
16PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
17
18# where can we find the peers config files?
19CFGALICE="-c $PREFIX/0/config"
20CFGBOB="-c $PREFIX/1/config"
21
22# launch two peers in line topology non-interactively
23#
24# interactive mode would terminate the test immediately
25# because the rest of the script is already in stdin,
26# thus redirecting stdin does not suffice)
27GNUNET_FORCE_LOG=';;;;ERROR'
28GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
29PID=$!
30# sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
31echo "Waiting for peers to start..."
32sleep 5
33# get Bob's peer ID, necessary for Alice
34PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
35
36echo "Running problem of size $SIZE"
37gnunet-scalarproduct $CFGBOB $INPUTBOB &
38time RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
39
40echo "Terminating testbed..."
41# terminate the testbed
42kill $PID
43