forked from mfontanini/packet-capture-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.sh
executable file
·35 lines (29 loc) · 914 Bytes
/
benchmark.sh
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
#!/bin/bash
packet_count=500000
payload_size=742
benchmark_runs=3
tests_count=3
tests=( $@ )
pcap_file=$(mktemp -t benchmark.XXXXXXXXXX)
results_file=$(mktemp -t benchmark-results.XXXXXXXXXX)
for test in $(seq 1 $tests_count)
do
echo "information $test $packet_count" >> $results_file
echo "[i] Generating $packet_count packets, each of size $packet_size"
./pcap_generator/generator $pcap_file $test $packet_count $payload_size
echo "[+] Done"
echo "[i] Executing test case $test"
for i in ${tests[@]}
do
echo "[i] Executing benchmark for library $i"
benchmark_input="packet"
if [ $test -eq 3 ]
then
benchmark_input="dns"
fi
output=$(./$i/benchmark $pcap_file $benchmark_input $benchmark_runs )
echo "$test $i $output" >> $results_file
done
done
rm $pcap_file
echo "[+] Done. Results saved in $results_file"