Commit 1a06b0f0 authored by Joanne Hugé's avatar Joanne Hugé

Fix interval option not being present in txtime and run_server scripts

parent 551e86c2
...@@ -3,15 +3,16 @@ ...@@ -3,15 +3,16 @@
script_dir=$(dirname $(realpath $0)) script_dir=$(dirname $(realpath $0))
usage() { usage() {
echo "Usage: $0 [[-bt] [-g INTERVAL]] | -d NB_PACKETS]" 1>&2; echo "Usage: $0 [[-bt] [-g INTERVAL]] | (-d NB_PACKETS [-i INTERVAL])" 1>&2;
exit 1; exit 1;
} }
# Default options # Default options
server_options="-a -p 99 -f eth0" server_options="-a -p 99 -f eth0"
ip="192.168.99." ip="192.168.99."
tcpdump_interval=1000000
while getopts "b:htd:g:" opt; do while getopts "b:htd:i:g:" opt; do
case "${opt}" in case "${opt}" in
b ) b )
use_rtt=1 use_rtt=1
...@@ -21,6 +22,9 @@ while getopts "b:htd:g:" opt; do ...@@ -21,6 +22,9 @@ while getopts "b:htd:g:" opt; do
use_tcpdump=1 use_tcpdump=1
nb_packets=${OPTARG} nb_packets=${OPTARG}
;; ;;
i )
tcpdump_interval=${OPTARG}
;;
g ) g )
interval=${OPTARG} interval=${OPTARG}
server_options+=" -g -i $interval" server_options+=" -g -i $interval"
...@@ -69,8 +73,8 @@ if [ -n "${use_tcpdump}" ]; then ...@@ -69,8 +73,8 @@ if [ -n "${use_tcpdump}" ]; then
echo "tshark -r tmp.pcap --disable-protocol dcp-etsi --disable-protocol dcp-pft -t e -E separator=, -T fields -e frame.number -e frame.time_epoch -e data.data > tmp.out"; echo "tshark -r tmp.pcap --disable-protocol dcp-etsi --disable-protocol dcp-pft -t e -E separator=, -T fields -e frame.number -e frame.time_epoch -e data.data > tmp.out";
tshark -r server_stats_tmp.pcap --disable-protocol dcp-etsi --disable-protocol dcp-pft -t e -E separator=, -T fields -e frame.number -e frame.time_epoch -e data.data > server_stats_tmp.out; tshark -r server_stats_tmp.pcap --disable-protocol dcp-etsi --disable-protocol dcp-pft -t e -E separator=, -T fields -e frame.number -e frame.time_epoch -e data.data > server_stats_tmp.out;
echo "txtime_stats.py -f server_pcap_stats"; echo "txtime_stats.py -f server_pcap_stats -i $tcpdump_interval";
$script_dir/txtime_stats.py -f server_stats_tmp.out; $script_dir/txtime_stats.py -f server_stats_tmp.out -i $tcpdump_interval;
else else
echo "make server"; echo "make server";
......
...@@ -27,7 +27,7 @@ import struct ...@@ -27,7 +27,7 @@ import struct
import math import math
import sys import sys
def compute_offsets_stats(file_path): def compute_offsets_stats(file_path, interval):
measure_set = {} measure_set = {}
measure_set["measure_type"] = "packet_jitter_tcpdump" measure_set["measure_type"] = "packet_jitter_tcpdump"
...@@ -55,7 +55,7 @@ def compute_offsets_stats(file_path): ...@@ -55,7 +55,7 @@ def compute_offsets_stats(file_path):
if histogram_index < 0 or histogram_index > 2000: if histogram_index < 0 or histogram_index > 2000:
print("jitter too high: {}\n".format(jitter)) print("jitter too high: {}\n".format(jitter))
else: else:
histogram[histogram_index]++ histogram[histogram_index] += 1
# Update statistics. # Update statistics.
min_t = jitter if jitter < min_t else min_t min_t = jitter if jitter < min_t else min_t
...@@ -79,17 +79,23 @@ def compute_offsets_stats(file_path): ...@@ -79,17 +79,23 @@ def compute_offsets_stats(file_path):
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument('-f', dest='file_path', default=None, type=str,
'-f', dest='file_path', default=None, type=str,
help='Path to input file (e.g. DATA.out) generated by tshark with:\ help='Path to input file (e.g. DATA.out) generated by tshark with:\
tshark -r CAPTURE.pcap -t e -E separator=, -T\ tshark -r CAPTURE.pcap -t e -E separator=, -T\
fields -e frame.number -e frame.time_epoch\ fields -e frame.number -e frame.time_epoch\
-e data.data > DATA.out') -e data.data > DATA.out')
parser.add_argument('-i', nargs=1, required=False, help='Indicate which interval was used')
# Default interval
interval = 1000000
args = parser.parse_args() args = parser.parse_args()
if args.i is not None:
interval = args.i[0]
if args.file_path is not None: if args.file_path is not None:
compute_offsets_stats(args.file_path) compute_offsets_stats(args.file_path, interval)
else: else:
parser.print_help() parser.print_help()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment