From d4f864cbd252a6156f7cc4b04f3daf1cd5149fc0 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 15 Aug 2018 19:21:15 +0200 Subject: Multiple configurations --- analyze.sh | 2 ++ analyze3.sh | 54 +++++++++++++++++++++++++++++++++ cfg | 1 + cfg-p2p-camera3/ipecamera0.sh | 3 ++ cfg-p2p-camera3/ipecamera3.sh | 3 ++ cfg-p2p-camera3/ipecamera4.sh | 3 ++ cfg-p2p-camera3/ipecamera5.sh | 3 ++ cfg-p2p-camera3/ipecamera6.sh | 3 ++ cfg-p2p-camera6/ipecamera0.sh | 3 ++ cfg-p2p-camera6/ipecamera3.sh | 3 ++ cfg-p2p-camera6/ipecamera4.sh | 3 ++ cfg-p2p-camera6/ipecamera5.sh | 3 ++ cfg-p2p-camera6/ipecamera6.sh | 3 ++ cfg-switch/ipecamera0.sh | 3 ++ cfg-switch/ipecamera3.sh | 3 ++ cfg-switch/ipecamera4.sh | 3 ++ cfg-switch/ipecamera5.sh | 3 ++ cfg-switch/ipecamera6.sh | 3 ++ cfg/ipecamera0.sh | 3 -- cfg/ipecamera3.sh | 3 -- cfg/ipecamera4.sh | 3 -- cfg/ipecamera5.sh | 3 -- cfg/ipecamera6.sh | 3 -- run-server.sh | 19 +++++++----- src/ReceiverThreads/ReceiverThreads.cpp | 2 +- src/main_server.cpp | 1 + 26 files changed, 116 insertions(+), 23 deletions(-) create mode 100755 analyze3.sh create mode 120000 cfg create mode 100644 cfg-p2p-camera3/ipecamera0.sh create mode 100644 cfg-p2p-camera3/ipecamera3.sh create mode 100644 cfg-p2p-camera3/ipecamera4.sh create mode 100644 cfg-p2p-camera3/ipecamera5.sh create mode 100644 cfg-p2p-camera3/ipecamera6.sh create mode 100644 cfg-p2p-camera6/ipecamera0.sh create mode 100644 cfg-p2p-camera6/ipecamera3.sh create mode 100644 cfg-p2p-camera6/ipecamera4.sh create mode 100644 cfg-p2p-camera6/ipecamera5.sh create mode 100644 cfg-p2p-camera6/ipecamera6.sh create mode 100644 cfg-switch/ipecamera0.sh create mode 100644 cfg-switch/ipecamera3.sh create mode 100644 cfg-switch/ipecamera4.sh create mode 100644 cfg-switch/ipecamera5.sh create mode 100644 cfg-switch/ipecamera6.sh delete mode 100644 cfg/ipecamera0.sh delete mode 100644 cfg/ipecamera3.sh delete mode 100644 cfg/ipecamera4.sh delete mode 100644 cfg/ipecamera5.sh delete mode 100644 cfg/ipecamera6.sh diff --git a/analyze.sh b/analyze.sh index 33799cc..c0a8be1 100755 --- a/analyze.sh +++ b/analyze.sh @@ -3,6 +3,8 @@ sleep=1 int=$(ip addr show | grep "192\.168\.2\." | awk '{ print $NF }') +[ -n "$1" ] && int="$1" + stats1=($(ethtool -S $int | grep -P "rx\d?_(packets|bytes)" | awk '{ print $2 }')) sleep $sleep diff --git a/analyze3.sh b/analyze3.sh new file mode 100755 index 0000000..256a4c5 --- /dev/null +++ b/analyze3.sh @@ -0,0 +1,54 @@ +#! /bin/bash + +sleep=1 + +#Doesn't work with LibVMA. +#iptables -D INPUT -p udp --match multiport --dports 4000:4100 -j traf &> /dev/null +#iptables -X traf &> /dev/null +#iptables -N traf +#iptables -A INPUT -p udp --match multiport --dports 4000:4100 -j traf +#iptables -Z traf +#iptables -L traf -v -n -x + +function stat { + ints=$1 + + for i in "${!ints[@]}"; do + int="${ints[$i]}" + stats1[$i]=$(ethtool -S $int | grep -P "rx_(packets|bytes)_phy" | awk '{ print $2 }') + done + sleep $sleep + for i in "${!ints[@]}"; do + int="${ints[$i]}" + stats2[$i]=$(ethtool -S $int | grep -P "rx_(packets|bytes)_phy" | awk '{ print $2 }') + done + + pksum=0 + bwsum=0 + for i in "${!stats1[@]}"; do + stat1=(${stats1[$i]}) + stat2=(${stats2[$i]}) + + pk1=${stat1[0]} + pk2=${stat2[0]} + + bw1=${stat1[1]} + bw2=${stat2[1]} + + pkdiff=$(bc <<< "($pk2 - $pk1) / $sleep") + bwdiff=$(bc <<< "($bw2 - $bw1) / $sleep") + + printf "%10s" "${ints[$i]}" + printf " packets: %9.3f kpps" $(bc -l <<< "1. * $pkdiff / 1000") + printf ", bandwidth: %9.3f Gb/s\n" $(bc -l <<< "8. * $bwdiff / 1024 / 1024 / 1024") + + pksum=$(($pksum + $pkdiff)) + bwsum=$(($bwsum + $bwdiff)) + done + printf "%10s" "Total" + printf " packets: %9.3f kpps" $(bc -l <<< "1. * $pksum / 1000") + printf ", bandwidth: %9.3f Gb/s\n" $(bc -l <<< "8. * $bwsum / 1024 / 1024 / 1024") +} + +ints=(ens1 ens11 ens1d1 ens11d1) +stat $ints diff --git a/cfg b/cfg new file mode 120000 index 0000000..7b9dd64 --- /dev/null +++ b/cfg @@ -0,0 +1 @@ +cfg-p2p-camera6 \ No newline at end of file diff --git a/cfg-p2p-camera3/ipecamera0.sh b/cfg-p2p-camera3/ipecamera0.sh new file mode 100644 index 0000000..e96f415 --- /dev/null +++ b/cfg-p2p-camera3/ipecamera0.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.3.83 4022 5 1500 diff --git a/cfg-p2p-camera3/ipecamera3.sh b/cfg-p2p-camera3/ipecamera3.sh new file mode 100644 index 0000000..b058a6b --- /dev/null +++ b/cfg-p2p-camera3/ipecamera3.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-server.sh 0.0.0.0 4000 27 1500 diff --git a/cfg-p2p-camera3/ipecamera4.sh b/cfg-p2p-camera3/ipecamera4.sh new file mode 100644 index 0000000..f2045cc --- /dev/null +++ b/cfg-p2p-camera3/ipecamera4.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.34.83 4008 8 1500 diff --git a/cfg-p2p-camera3/ipecamera5.sh b/cfg-p2p-camera3/ipecamera5.sh new file mode 100644 index 0000000..66a8d28 --- /dev/null +++ b/cfg-p2p-camera3/ipecamera5.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.35.83 4016 6 1500 diff --git a/cfg-p2p-camera3/ipecamera6.sh b/cfg-p2p-camera3/ipecamera6.sh new file mode 100644 index 0000000..ebb1b4b --- /dev/null +++ b/cfg-p2p-camera3/ipecamera6.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.36.83 4000 8 1500 diff --git a/cfg-p2p-camera6/ipecamera0.sh b/cfg-p2p-camera6/ipecamera0.sh new file mode 100644 index 0000000..e16dfc3 --- /dev/null +++ b/cfg-p2p-camera6/ipecamera0.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.6.86 4022 5 1500 diff --git a/cfg-p2p-camera6/ipecamera3.sh b/cfg-p2p-camera6/ipecamera3.sh new file mode 100644 index 0000000..65d40ac --- /dev/null +++ b/cfg-p2p-camera6/ipecamera3.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.36.86 4000 8 1500 diff --git a/cfg-p2p-camera6/ipecamera4.sh b/cfg-p2p-camera6/ipecamera4.sh new file mode 100644 index 0000000..7e329fb --- /dev/null +++ b/cfg-p2p-camera6/ipecamera4.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.46.86 4008 8 1500 diff --git a/cfg-p2p-camera6/ipecamera5.sh b/cfg-p2p-camera6/ipecamera5.sh new file mode 100644 index 0000000..099ae28 --- /dev/null +++ b/cfg-p2p-camera6/ipecamera5.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.56.86 4016 6 1500 diff --git a/cfg-p2p-camera6/ipecamera6.sh b/cfg-p2p-camera6/ipecamera6.sh new file mode 100644 index 0000000..b058a6b --- /dev/null +++ b/cfg-p2p-camera6/ipecamera6.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-server.sh 0.0.0.0 4000 27 1500 diff --git a/cfg-switch/ipecamera0.sh b/cfg-switch/ipecamera0.sh new file mode 100644 index 0000000..a93d716 --- /dev/null +++ b/cfg-switch/ipecamera0.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.2.86 4022 5 1500 diff --git a/cfg-switch/ipecamera3.sh b/cfg-switch/ipecamera3.sh new file mode 100644 index 0000000..28b2ca9 --- /dev/null +++ b/cfg-switch/ipecamera3.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.2.86 4000 8 1500 diff --git a/cfg-switch/ipecamera4.sh b/cfg-switch/ipecamera4.sh new file mode 100644 index 0000000..f1ce0b0 --- /dev/null +++ b/cfg-switch/ipecamera4.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.2.86 4008 8 1500 diff --git a/cfg-switch/ipecamera5.sh b/cfg-switch/ipecamera5.sh new file mode 100644 index 0000000..cc9e34b --- /dev/null +++ b/cfg-switch/ipecamera5.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-client.sh 192.168.2.86 4016 6 1500 diff --git a/cfg-switch/ipecamera6.sh b/cfg-switch/ipecamera6.sh new file mode 100644 index 0000000..25528fd --- /dev/null +++ b/cfg-switch/ipecamera6.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./run-server.sh 192.168.2.86 4000 27 1500 diff --git a/cfg/ipecamera0.sh b/cfg/ipecamera0.sh deleted file mode 100644 index a93d716..0000000 --- a/cfg/ipecamera0.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -./run-client.sh 192.168.2.86 4022 5 1500 diff --git a/cfg/ipecamera3.sh b/cfg/ipecamera3.sh deleted file mode 100644 index 28b2ca9..0000000 --- a/cfg/ipecamera3.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -./run-client.sh 192.168.2.86 4000 8 1500 diff --git a/cfg/ipecamera4.sh b/cfg/ipecamera4.sh deleted file mode 100644 index f1ce0b0..0000000 --- a/cfg/ipecamera4.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -./run-client.sh 192.168.2.86 4008 8 1500 diff --git a/cfg/ipecamera5.sh b/cfg/ipecamera5.sh deleted file mode 100644 index cc9e34b..0000000 --- a/cfg/ipecamera5.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -./run-client.sh 192.168.2.86 4016 6 1500 diff --git a/cfg/ipecamera6.sh b/cfg/ipecamera6.sh deleted file mode 100644 index 25528fd..0000000 --- a/cfg/ipecamera6.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -./run-server.sh 192.168.2.86 4000 27 1500 diff --git a/run-server.sh b/run-server.sh index 8b04859..51f947d 100755 --- a/run-server.sh +++ b/run-server.sh @@ -3,8 +3,11 @@ . config.sh function run { -# VMA_TRACELEVEL=DEBUG VMA_THREAD_MODE=3 VMA_MTU=0 VMA_RX_POLL=0 VMA_SELECT_POLL=0 VMA_RING_ALLOCATION_LOGIC_RX=20 VMA_RX_BUFS=800000 LD_PRELOAD=$vma_lib $ods_path/bin/onlineDetectorSimulatorServer "$@" - VMA_THREAD_MODE=3 VMA_MTU=0 VMA_RX_POLL=0 VMA_SELECT_POLL=0 VMA_RING_ALLOCATION_LOGIC_RX=20 VMA_RX_BUFS=800000 LD_PRELOAD=$vma_lib $ods_path/bin/onlineDetectorSimulatorServer "$@" + bufs=800000 + [ $ip == "0.0.0.0" ] && bufs=$((bufs * 4)) + +# VMA_TRACELEVEL=DEBUG VMA_THREAD_MODE=3 VMA_MTU=0 VMA_RX_POLL=0 VMA_SELECT_POLL=0 VMA_RING_ALLOCATION_LOGIC_RX=20 VMA_RX_BUFS=$bufs LD_PRELOAD=$vma_lib $ods_path/bin/onlineDetectorSimulatorServer "$@" + VMA_THREAD_MODE=3 VMA_MTU=0 VMA_RX_POLL=0 VMA_SELECT_POLL=0 VMA_RING_ALLOCATION_LOGIC_RX=20 VMA_RX_BUFS=$bufs LD_PRELOAD=$vma_lib $ods_path/bin/onlineDetectorSimulatorServer "$@" # $ods_path/bin/onlineDetectorSimulatorServer "$@" } @@ -18,14 +21,16 @@ mtu=1500 #max 9000 [ -n "$3" ] && num_ports=$3 [ -n "$4" ] && mtu=$4 -ipinfo=$(ip addr show | grep $ip) -[ $? -eq 0 ] || { echo "Specified IP $ip is not found" ; exit 1 ; } -int=$(echo $ipinfo | awk '{print $NF}') - echo 1000000000 > /proc/sys/kernel/shmmax # 18446744073692774399 echo 8000 > /proc/sys/vm/nr_hugepages # 0 +if [ $ip != "0.0.0.0" ]; then + ipinfo=$(ip addr show | grep $ip) + [ $? -eq 0 ] || { echo "Specified IP $ip is not found" ; exit 1 ; } + int=$(echo $ipinfo | awk '{print $NF}') + + ip link set $int mtu $mtu +fi -ip link set $int mtu $mtu run $ip $first_port $num_ports diff --git a/src/ReceiverThreads/ReceiverThreads.cpp b/src/ReceiverThreads/ReceiverThreads.cpp index e86fae5..688de00 100644 --- a/src/ReceiverThreads/ReceiverThreads.cpp +++ b/src/ReceiverThreads/ReceiverThreads.cpp @@ -162,7 +162,7 @@ auto ReceiverThreads::receiverThread(const int port) -> void { auto ts = std::chrono::high_resolution_clock::now(); std::chrono::nanoseconds d = ts - ts_last; if (d.count() >= 1000000000) { - printf("Lost %.2lf%, Received: %i (%zu bytes, %.3lf GBit/s) in %.3lf ms [VMA: %i]\n", loss / (double)(lastIndex - rcv_index)*100.0, rcv_packets, rcv_size, 8. * rcv_size * coef / d.count() , 1. * d.count() / 1000000, (vma_?1:0)); + printf("Lost %.2lf%, Received: %i (%zu bytes, %.3lf GBit/s) in %.3lf ms [VMA: %i, port: %i]\n", loss / (double)(lastIndex - rcv_index)*100.0, rcv_packets, rcv_size, 8. * rcv_size * coef / d.count() , 1. * d.count() / 1000000, (vma_?1:0), port); rcv_packets = 0; rcv_size = 0; rcv_index = lastIndex; diff --git a/src/main_server.cpp b/src/main_server.cpp index 7c6cee4..2e248e1 100644 --- a/src/main_server.cpp +++ b/src/main_server.cpp @@ -2,6 +2,7 @@ #include "ReceiverThreads/ReceiverThreads.h" #include +#include #include #include -- cgit v1.2.1