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 @@
script_dir=$(dirname $(realpath $0))
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;
}
# Default options
server_options="-a -p 99 -f eth0"
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
b )
use_rtt=1
......@@ -21,6 +22,9 @@ while getopts "b:htd:g:" opt; do
use_tcpdump=1
nb_packets=${OPTARG}
;;
i )
tcpdump_interval=${OPTARG}
;;
g )
interval=${OPTARG}
server_options+=" -g -i $interval"
......@@ -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";
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";
$script_dir/txtime_stats.py -f server_stats_tmp.out;
echo "txtime_stats.py -f server_pcap_stats -i $tcpdump_interval";
$script_dir/txtime_stats.py -f server_stats_tmp.out -i $tcpdump_interval;
else
echo "make server";
......
......@@ -27,7 +27,7 @@ import struct
import math
import sys
def compute_offsets_stats(file_path):
def compute_offsets_stats(file_path, interval):
measure_set = {}
measure_set["measure_type"] = "packet_jitter_tcpdump"
......@@ -55,7 +55,7 @@ def compute_offsets_stats(file_path):
if histogram_index < 0 or histogram_index > 2000:
print("jitter too high: {}\n".format(jitter))
else:
histogram[histogram_index]++
histogram[histogram_index] += 1
# Update statistics.
min_t = jitter if jitter < min_t else min_t
......@@ -79,17 +79,23 @@ def compute_offsets_stats(file_path):
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'-f', dest='file_path', default=None, type=str,
help='Path to input file (e.g. DATA.out) generated by tshark with:\
tshark -r CAPTURE.pcap -t e -E separator=, -T\
fields -e frame.number -e frame.time_epoch\
-e data.data > DATA.out')
parser.add_argument('-f', dest='file_path', default=None, type=str,
help='Path to input file (e.g. DATA.out) generated by tshark with:\
tshark -r CAPTURE.pcap -t e -E separator=, -T\
fields -e frame.number -e frame.time_epoch\
-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()
if args.i is not None:
interval = args.i[0]
if args.file_path is not None:
compute_offsets_stats(args.file_path)
compute_offsets_stats(args.file_path, interval)
else:
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