summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-08-15 19:21:15 +0200
committerSuren A. Chilingaryan <csa@suren.me>2018-08-15 19:21:15 +0200
commitd4f864cbd252a6156f7cc4b04f3daf1cd5149fc0 (patch)
tree253bd26151e1d53d977344189b37bc77322036fc
parent5cdb425d6843c100189611c2edb37b03efc1dc5a (diff)
downloadods-d4f864cbd252a6156f7cc4b04f3daf1cd5149fc0.tar.gz
ods-d4f864cbd252a6156f7cc4b04f3daf1cd5149fc0.tar.bz2
ods-d4f864cbd252a6156f7cc4b04f3daf1cd5149fc0.tar.xz
ods-d4f864cbd252a6156f7cc4b04f3daf1cd5149fc0.zip
Multiple configurations
-rwxr-xr-xanalyze.sh2
-rwxr-xr-xanalyze3.sh54
l---------cfg1
-rw-r--r--cfg-p2p-camera3/ipecamera0.sh3
-rw-r--r--cfg-p2p-camera3/ipecamera3.sh3
-rw-r--r--cfg-p2p-camera3/ipecamera4.sh3
-rw-r--r--cfg-p2p-camera3/ipecamera5.sh3
-rw-r--r--cfg-p2p-camera3/ipecamera6.sh3
-rw-r--r--cfg-p2p-camera6/ipecamera0.sh3
-rw-r--r--cfg-p2p-camera6/ipecamera3.sh3
-rw-r--r--cfg-p2p-camera6/ipecamera4.sh3
-rw-r--r--cfg-p2p-camera6/ipecamera5.sh3
-rw-r--r--cfg-p2p-camera6/ipecamera6.sh3
-rw-r--r--cfg-switch/ipecamera0.sh (renamed from cfg/ipecamera0.sh)0
-rw-r--r--cfg-switch/ipecamera3.sh (renamed from cfg/ipecamera3.sh)0
-rw-r--r--cfg-switch/ipecamera4.sh (renamed from cfg/ipecamera4.sh)0
-rw-r--r--cfg-switch/ipecamera5.sh (renamed from cfg/ipecamera5.sh)0
-rw-r--r--cfg-switch/ipecamera6.sh (renamed from cfg/ipecamera6.sh)0
-rwxr-xr-xrun-server.sh19
-rw-r--r--src/ReceiverThreads/ReceiverThreads.cpp2
-rw-r--r--src/main_server.cpp1
21 files changed, 101 insertions, 8 deletions
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/ipecamera0.sh b/cfg-switch/ipecamera0.sh
index a93d716..a93d716 100644
--- a/cfg/ipecamera0.sh
+++ b/cfg-switch/ipecamera0.sh
diff --git a/cfg/ipecamera3.sh b/cfg-switch/ipecamera3.sh
index 28b2ca9..28b2ca9 100644
--- a/cfg/ipecamera3.sh
+++ b/cfg-switch/ipecamera3.sh
diff --git a/cfg/ipecamera4.sh b/cfg-switch/ipecamera4.sh
index f1ce0b0..f1ce0b0 100644
--- a/cfg/ipecamera4.sh
+++ b/cfg-switch/ipecamera4.sh
diff --git a/cfg/ipecamera5.sh b/cfg-switch/ipecamera5.sh
index cc9e34b..cc9e34b 100644
--- a/cfg/ipecamera5.sh
+++ b/cfg-switch/ipecamera5.sh
diff --git a/cfg/ipecamera6.sh b/cfg-switch/ipecamera6.sh
index 25528fd..25528fd 100644
--- a/cfg/ipecamera6.sh
+++ b/cfg-switch/ipecamera6.sh
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 <iostream>
+#include <functional>
#include <string>
#include <thread>