diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-13 16:40:18 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-13 16:40:18 +0200 |
commit | f69c5e0593e0115e48d7a3138f64c183757f6066 (patch) | |
tree | 2f8446c16f78b7ca55c82f0f54abe21d6b30e3e5 /contrib | |
parent | 334b50de9fc2e492e5801c43b42074d8e2e65259 (diff) | |
download | gnunet-f69c5e0593e0115e48d7a3138f64c183757f6066.tar.gz gnunet-f69c5e0593e0115e48d7a3138f64c183757f6066.zip |
add shell script to convert result of zonewalk to input for gnunet-gns-benchmark
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/zonewalk-to-types.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/contrib/zonewalk-to-types.sh b/contrib/zonewalk-to-types.sh new file mode 100755 index 000000000..c5096e695 --- /dev/null +++ b/contrib/zonewalk-to-types.sh | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/bin/sh | ||
2 | # This script is in the public domain. | ||
3 | # Converts the output of gnunet-zonewalk (DNS resolutions) | ||
4 | # into a proper input for gnunet-gns-benchmark. | ||
5 | |||
6 | NUM_CLIENTS=3 | ||
7 | # How many different groups of names should we | ||
8 | # create? 1/N will be in the 'shared' group. | ||
9 | |||
10 | # FILE ($1) contains results from DNS lookup; strip | ||
11 | # everything but the hostnames, remove duplicates | ||
12 | # and then randomize the order. | ||
13 | cat $1 | awk '{print $1}' | sort | uniq | shuf > $1.tmp | ||
14 | TOTAL=`cat $1.tmp | wc -l` | ||
15 | GROUP_SIZE=`expr $TOTAL / \( $NUM_TYPES + 1 \)` | ||
16 | |||
17 | # First group (0) is to be shared among all clients | ||
18 | for i in `seq 1 $NUM_CLIENTS` | ||
19 | do | ||
20 | cat $1.tmp | head -n $GROUP_SIZE | awk "{print 0 \" \" \$1}" > $1.$i.tmp | ||
21 | done | ||
22 | |||
23 | # Second group (1) is unique per client | ||
24 | OFF=0 | ||
25 | for i in `seq 0 $NUM_CLIENTS` | ||
26 | do | ||
27 | END=`expr $OFF + $GROUP_SIZE` | ||
28 | cat $1.tmp | head -n $END | tail -n $GROUP_SIZE | awk "{print 1 \" \" \$1}" >> $1.$i.tmp | ||
29 | # Shuffle again, so we mix the different request categories in terms of | ||
30 | # when we issue the queries. | ||
31 | cat $1.$i.tmp | shuf > $1.$i | ||
32 | OFF="$END" | ||
33 | rm $1.$i.tmp | ||
34 | done | ||
35 | rm $1.tmp | ||