Commit 85bef512 authored by Joanne Hugé's avatar Joanne Hugé

Fix histogram printing bugs, add new scripts

Print lost packets in the server histogram
Remove trailing comma in client histogram printing
Prevent user to enable histgrams without enabling timestamps in client wrapper script
Rename scripts by replacing underscores with a dash

Add packet-histogram-start and packet-histogram-stop scripts,
which automates the generation of histograms by ssh'ing on the
boards using expect script
parent f6022349
This diff is collapsed.
...@@ -274,9 +274,10 @@ static void print_histograms() { ...@@ -274,9 +274,10 @@ static void print_histograms() {
"\"props_names\": [\"kernel_space\"]," "\"props_names\": [\"kernel_space\"],"
"\"units\": [\"us\"]," "\"units\": [\"us\"],"
"\"props_type\": \"histogram\"," "\"props_type\": \"histogram\","
"\"metadata\": {\"i\": \"%dus\", \"duration\": \"%dh%d\"}," "\"metadata\": {\"i\": \"%dus\", \"duration\": \"%dh%d\","
"\"lost_packets\": \"%d\"},"
"\"props\": [[", "\"props\": [[",
interval, duration_hour, duration_minutes); interval, duration_hour, duration_minutes, ingress_stats.lost_packets);
max_latency = histogram_max(kernel_latency_hist, MAX_KERNEL_LATENCY - 1); max_latency = histogram_max(kernel_latency_hist, MAX_KERNEL_LATENCY - 1);
...@@ -295,9 +296,11 @@ static void print_histograms() { ...@@ -295,9 +296,11 @@ static void print_histograms() {
"\"units\": [\"us\"]," "\"units\": [\"us\"],"
"\"props_type\": \"histogram\"," "\"props_type\": \"histogram\","
"\"middle\": \"%d\"," "\"middle\": \"%d\","
"\"metadata\": {\"i\": \"%dus\", \"duration\": \"%dh%d\"}," "\"metadata\": {\"i\": \"%dus\", \"duration\": \"%dh%d\","
"\"lost_packets\": \"%d\"},"
"\"props\": [[", "\"props\": [[",
MAX_JITTER / 2 - min_jitter, interval, duration_hour, duration_minutes); MAX_JITTER / 2 - min_jitter, interval, duration_hour, duration_minutes,
ingress_stats.lost_packets);
for (int j = min_jitter; j < max_jitter; j++) for (int j = min_jitter; j < max_jitter; j++)
printf("%" PRIi64 "%s", jitter_hist[j], (j + 1 < max_jitter ? ", " : "")); printf("%" PRIi64 "%s", jitter_hist[j], (j + 1 < max_jitter ? ", " : ""));
......
#!/bin/bash
usage() {
echo "Usage: $0 OPTIONS -c OUTPUT CLIENT_BOARD SERVER_BOARD" 1>&2;
echo " $0 OPTIONS -s OUTPUT [-t] (-p | (-e DELTA -o ETF_OFFSET)) CLIENT_BOARD SERVER_BOARD" 1>&2;
echo " $0 OPTIONS -C OUTPUT [-l]" 1>&2;
echo "OPTIONS: [-h] [-i INTERVAL]" 1>&2;
exit 1;
}
script_dir=$(dirname $(realpath $0))
interval=1000
while getopts "hb:i:c:s:tjpe:o:C:l" opt; do
case "${opt}" in
h )
usage
;;
b )
board=${OPTARG}
;;
i )
interval=${OPTARG}
;;
c )
client_histogram=1
output=${OPTARG}
;;
s )
server_histogram=1
output=${OPTARG}
;;
t )
server_timestamps=1
;;
p )
server_pfifo=1
;;
e )
server_etf=1
etf_delta=${OPTARG}
;;
o )
etf_offset=${OPTARG}
;;
C )
cyclictest_histogram=1
output=${OPTARG}
;;
l )
stop_load=1
;;
* )
usage
;;
esac
done
shift $((OPTIND-1))
if [ -n "$client_histogram" ] || [ -n "$server_histogram" ]; then
if [ $# -ne 2 ]; then
echo "Wrong number of arguments";
usage
else
client_board=$1
server_board=$2
fi
elif [ -n "$cyclictest_histogram" ]; then
if [ $# -ne 1 ]; then
echo "Wrong number of arguments";
usage
else
board=$1
fi
else
echo "You need to choose between client, server or cyclictest histogram";
usage
fi
if [ -n "$client_histogram" ]; then
ssh -t $client_board "echo olimex | sudo -S killall client";
ssh -t $server_board "echo olimex | sudo -S killall server";
scp $client_board:$output $script_dir/;
cd $script_dir/../measure-analysis;
./measure-analysis.py -i $script_dir/$output;
./measure-analysis.py -R;
elif [ -n "$server_histogram" ]; then
ssh -t $server_board "echo olimex | sudo -S killall server";
ssh -t $client_board "echo olimex | sudo -S killall client";
scp $server_board:$output $script_dir/;
cd $script_dir/../measure-analysis;
./measure-analysis.py -i $script_dir/$output;
./measure-analysis.py -R;
elif [ -n "$cyclictest_histogram" ]; then
ssh -t $board "echo olimex | sudo -S killall cyclictest";
if [ -n "$stop_load" ]; then
ssh -t $board "echo olimex | sudo -S killall run-cyclictest";
ssh -t $board "echo olimex | sudo -S killall hackbench";
fi
scp $board:$output $script_dir/;
cd $script_dir/../measure-analysis;
./measure-analysis.py -i $script_dir/$output -c;
./measure-analysis.py -R;
fi
#!/bin/expect
spawn ssh [lindex $argv 0]
expect "oli@"
send -- "sudo echo\r"
expect "assword"
send -- "olimex\r"
expect "oli@"
send -- "sudo nohup [lindex $argv 1] > /dev/null > /dev/null &\r"
expect "stdout\r"
send -- \x03
expect "oli@"
#!/bin/bash
usage() {
echo "Usage: $0 OPTIONS -c CLIENT_BOARD SERVER_BOARD" 1>&2;
echo " $0 OPTIONS -s [-t] (-p | (-e DELTA -o ETF_OFFSET)) CLIENT_BOARD SERVER_BOARD" 1>&2;
echo " $0 OPTIONS -C [-l] BOARD" 1>&2;
echo "OPTIONS: [-h] [-i INTERVAL]" 1>&2;
exit 1;
}
script_dir=$(dirname $(realpath $0))
interval=1000
server_opts=""
cyclictest_opts=""
etf_offset=600
while getopts "hi:csCtpe:o:l" opt; do
case "${opt}" in
h )
usage
;;
i )
interval=${OPTARG}
;;
c )
client_histogram=1
;;
s )
server_histogram=1
;;
t )
server_opts+=" -t"
;;
p )
server_pfifo=1
;;
e )
server_etf=1
etf_delta=${OPTARG}
;;
o )
etf_offset=${OPTARG}
;;
C )
cyclictest_histogram=1
;;
l )
cyclictest_opts+=" -l"
;;
* )
usage
;;
esac
done
shift $((OPTIND-1))
if [ -n "$client_histogram" ] || [ -n "$server_histogram" ]; then
if [ $# -ne 2 ]; then
echo "Wrong number of arguments";
usage
else
client_board=$1
server_board=$2
fi
elif [ -n "$cyclictest_histogram" ]; then
if [ $# -ne 1 ]; then
echo "Wrong number of arguments";
usage
else
board=$1
fi
else
echo "You need to choose between client, server or cyclictest histogram";
usage
fi
# Client histogram
if [ -n "$client_histogram" ]; then
$script_dir/exec-ssh-nohup $server_board "run-server";
$script_dir/exec-ssh-nohup $client_board "run-client -p -i $interval -t -g $server_board";
echo "-c client_i${interval}_pfast -i $interval $client_board $server_board" > $script_dir/packet-histogram-stop_options;
# Server histogram
elif [ -n "$server_histogram" ]; then
# Server pfifo_fast qdisc histogram
if [ -n "$server_pfifo" ]; then
$script_dir/exec-ssh-nohup $server_board "run-server -g ${interval}$server_opts";
$script_dir/exec-ssh-nohup $client_board "run-client -p -i $interval $server_board";
echo "-i $interval -s server_i${interval} $server_opts -p $client_board $server_board" > $script_dir/packet-histogram-stop_options;
# Server ETF qdisc histogram
elif [ -n "$server_etf" ]; then
$script_dir/exec-ssh-nohup $server_board "run-server -g ${interval}$server_opts";
$script_dir/exec-ssh-nohup $client_board "run-client -e $etf_delta -o $etf_offset -i $interval $server_board";
echo "-i $interval -s server_i${interval} $server_opts -e $etf_delta -o $etf_offset $client_board $server_board" > $script_dir/packet-histogram-stop_options;
else
echo "Server histogram requires choosing between pfifo_fast or etf qdisc";
usage
fi
# cyclictest histogram
elif [ -n "$cyclictest_histogram" ]; then
$script_dir/exec-ssh-nohup $board "run-cyclictest -g $cyclictest_opts -i $interval";
echo "-i $interval -C cyclictest_hist $cyclictest_opts $board" > $script_dir/packet-histogram-stop_options;
fi
#!/bin/bash
script_dir=$(dirname $(realpath $0))
$script_dir/_packet-histogram-stop `cat packet-histogram-stop_options`;
rm packet-histogram-stop_options
...@@ -49,6 +49,7 @@ while getopts "bd:e:o:ghi:pt" opt; do ...@@ -49,6 +49,7 @@ while getopts "bd:e:o:ghi:pt" opt; do
qdisc_options+="-p" qdisc_options+="-p"
;; ;;
t ) t )
use_timestamps=1
client_options+=" -t" client_options+=" -t"
;; ;;
* ) * )
...@@ -84,6 +85,9 @@ fi ...@@ -84,6 +85,9 @@ fi
if [ -z "${use_histogram}" ]; then if [ -z "${use_histogram}" ]; then
client_options+=" -v" client_options+=" -v"
else else
if [ -z "${use_timestamps}" ]; then
client_options+=" -t"
fi
output="client_i${interval}" output="client_i${interval}"
if [ -n "${use_pfast}" ]; then if [ -n "${use_pfast}" ]; then
output+="_pfast" output+="_pfast"
......
#!/bin/bash
usage() {
echo "Usage: $0 -hgl -i INTERVAL" 1>&2;
exit 1;
}
interval=1000
cyclictest_opts="-a1 -n -t1 -p99 -mlocakall"
while getopts "hgli:" opt; do
case "${opt}" in
h )
usage
;;
g )
generate_histogram=1
;;
l )
create_load=1
;;
i )
interval=${OPTARG}
;;
* )
usage
;;
esac
done
shift $((OPTIND-1))
cyclictest_opts+=" -i $interval"
if [ -n "$create_load" ]; then
while :
do
hackbench
done&
fi
if [ -n "$generate_histogram" ]; then
sudo cyclictest $cyclictest_opts -h 400 -q > cyclictest_hist
else
sudo cyclictest $cyclictest_opts
fi
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