Commit 0b4f456c authored by Joanne Hugé's avatar Joanne Hugé

Add new wrapper scripts to start client and server, and include a tcpdump listener option

parent eafb4bd6
#!/bin/bash
usage() {
echo "Usage: $0 -e delta|-p [-i INTERVAL]" 1>&2;
exit 1;
}
# Default interval
interval=100000
while getopts "e:i:p" opt; do
case "${opt}" in
e )
delta=${OPTARG}
use_etf=1
;;
i )
interval=${OPTARG}
;;
p )
use_pfast=1
;;
* )
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "${use_etf}" ] && [ -z "${use_pfast}" ]; then
usage
fi
if [ -n "${use_etf}" ] && [ -n "${use_pfast}" ]; then
usage
fi
if [ -n "${use_etf}" ]; then
create_qdisc -e $delta;
../packet-exchange/build/client_arm -ae -p 99 -q 7 -f eth0 -i $interval 192.168.99.25;
elif [ -n "${use_pfast}" ]; then
create_qdisc -p;
../packet-exchange/build/client_arm -a -p 99 -q 1 -f eth0 -i $interval 192.168.99.25;
fi
#!/bin/bash
usage() {
echo "Usage: $0 [-t] [-c NB_PACKETS]" 1>&2;
exit 1;
}
while getopts "c:t" opt; do
case "${opt}" in
c )
nb_packets=${OPTARG}
;;
t )
use_tcpdump=1
;;
* )
usage
;;
esac
done
shift $((OPTIND-1))
if [ -n "${use_tcpdump}" ]; then
./tcpdump -c $nb_packets -i eth0 -w tmp.pcap -tt --time-stamp-precision=nano udp port 50000;
./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;
./txtime_stats.py -f tmp.out;
else; then
../packet-exchange/build/server_arm -a -p 99;
fi
#!/usr/bin/env python3
#
# Copyright (c) 2018, Intel Corporation
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Expected input file format is a CSV file with:
#
# <FRAME_NUMBER, FRAME_ARRIVAL_TIME, FRAME_PAYLOAD_BYTES>
# E.g.:
# 1,1521534608.000000456,00:38:89:bd:a1:93:1d:15:(...)
# 2,1521534608.001000480,00:38:89:bd:a1:93:1d:15:(...)
#
# Frame number: sequence number for each frame
# Frame arrival time: Rx HW timestamp for each frame
# Frame Payload: payload starting with 64bit timestamp (txtime)
#
# This can be easily generated with tshark with the following command line:
# $ tshark -r CAPTURE.pcap -t e -E separator=, -T fields -e frame.number \
# -e frame.time_epoch \
# -e data.data > DATA.out
#
import argparse
import csv
import struct
import math
import sys
def compute_offsets_stats(file_path):
with open(file_path) as f:
min_t = sys.maxsize
max_t = -sys.maxsize
i = 0
prev_tstamp = 0
for line in csv.reader(f):
arrival_tstamp = int(line[1].replace('.', ''))
if i > 0:
val = arrival_tstamp - prev_tstamp
# Update statistics.
# Compute the mean and variance online using Welford's algorithm.
min_t = val if val < min_t else min_t
max_t = val if val > max_t else max_t
i += 1
prev_tstamp = arrival_tstamp
if i > 0:
print("Jitter: " + str((max_t - min_t) / 1000) + "us")
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')
args = parser.parse_args()
if args.file_path is not None:
compute_offsets_stats(args.file_path)
else:
parser.print_help()
if __name__ == "__main__":
main()
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