-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatency_new.sh
executable file
·73 lines (56 loc) · 2.48 KB
/
latency_new.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
BMV2_PATH=../../behavioral-model
P4C_BM_PATH=../../p4c
PKTGEN_PATH=../pktgen/build/p4benchmark
P4C_BM_SCRIPT=p4c-bm2-ss
SWITCH_PATH=$BMV2_PATH/targets/simple_switch/simple_switch
CLI_PATH=$BMV2_PATH/tools/runtime_CLI.py
PROG="main"
read -p "Enter the language version {14|16} = " VERSION
read -p "No. of Packets to send = " PACKETS
# VERSION="16"
# PACKETS="10000"
ps -ef | grep simple_switch | grep -v grep | awk '{print $2}' | xargs kill
#ps -ef | grep tshark | grep -v grep | awk '{print $2}' | xargs kill
rm latency.csv
rm -rf output/
for((j=1;j<=3;j++));
do
for ((i=1;i<=5;i++));
do
rm test_in.csv
rm test_out.csv
p4benchmark --feature pipeline --tables $i --table-size 32 --version $VERSION
#p4benchmark --feature parse-complex --depth $i --fanout 2 --version $VERSION
#p4benchmark --feature set-field --operations $i --version $VERSION
#p4benchmark --feature parse-header --fields 2 --headers $i --version $VERSION
cd output
set -m
$P4C_BM_SCRIPT --p4v $VERSION $PROG.p4 -o $PROG.json
if [ $? -ne 0 ]; then
echo "p4 compilation failed"
exit 1
fi
sudo tshark -c $PACKETS -i veth0 -T fields -e frame.time_epoch -e frame.number -E header=n -E quote=d -E occurrence=f >> ../test_in.csv &
sudo tshark -c $PACKETS -i veth4 -T fields -e frame.time_epoch -e frame.number -E header=n -E quote=d -E occurrence=f >> ../test_out.csv &
sleep 6
sudo echo "sudo" > /dev/null
sudo $SWITCH_PATH >/dev/null 2>&1
sudo $SWITCH_PATH $PROG.json \
-i 0@veth0 -i 1@veth2 -i 2@veth4 -i 3@veth6 -i 4@veth8 \
--log-console &
sleep 2
echo "**************************************"
echo "Sending commands to switch through CLI"
echo "**************************************"
$CLI_PATH --json $PROG.json < commands.txt
echo "READY!!!"
./run_test.py -n $PACKETS
ps -ef | grep simple_switch | grep -v grep | awk '{print $2}' | xargs kill
echo "Killed Switch Process"
cd ..
sleep 5
python edit_csv.py >> latency.csv
ps -ef | grep tshark | grep -v grep | awk '{print $2}' | xargs kill
done
done