--- /dev/null
+#!/bin/bash
+
+. lib.sh
+
+main() {
+ latester -d can0 -d can1 -o -c $COUNT -l 2 -h hist2.dat -f time2.dat
+ latester -d can0 -d can1 -o -c $COUNT -l 4 -h hist4.dat -f time4.dat
+ latester -d can0 -d can1 -o -c $COUNT -l 6 -h hist6.dat -f time6.dat
+ latester -d can0 -d can1 -o -c $COUNT -l 8 -h hist8.dat -f time8.dat
+}
+
+plot_cmds() {
+ cat <<EOF
+set title "No GW, two interfaces"
+set logscale y
+set grid
+set xlabel "Time [{/Symbol m}s]"
+set ylabel "Latency profile [messages]"
+plot [0:600] [1:$COUNT] \
+ "hist2.dat" with lp lt 1 title "2 byte messages", \
+ "hist4.dat" with lp lt 2 title "4 byte messages", \
+ "hist6.dat" with lp lt 3 title "6 byte messages", \
+ "hist8.dat" with lp lt 4 title "8 byte messages"
+EOF
+}
+
+test_end
+
FILE *file;
FILE *histogram;
int length;
+ int userhist;
};
struct options opt = {
{
struct timespec diff;
if (num_interfaces == 3)
- timespec_subtract(&diff, &mi->ts_rx_final_kern, &mi->ts_rx_onwire_kern);
+ if (opt.userhist)
+ timespec_subtract(&diff, &mi->ts_rx_final_kern, &mi->ts_rx_onwire_kern);
+ else
+ timespec_subtract(&diff, &mi->ts_rx_final, &mi->ts_rx_onwire);
else
- timespec_subtract(&diff, &mi->ts_rx_final_kern, &mi->ts_sent);
+ if (opt.userhist)
+ timespec_subtract(&diff, &mi->ts_rx_final, &mi->ts_sent);
+ else
+ timespec_subtract(&diff, &mi->ts_rx_final_kern, &mi->ts_sent);
return diff.tv_sec * 1000000 + diff.tv_nsec/1000;
}
static inline get_tstamp(struct timespec *ts)
{
- clock_gettime(CLOCK_MONOTONIC, ts);
+ clock_gettime(CLOCK_REALTIME, ts);
}
int send_frame(int socket)
{ "file", 'f', POPT_ARG_STRING, NULL, 'f', "File where to store results", "filename"},
{ "histogram", 'h', POPT_ARG_STRING, NULL, 'h', "Store histogram in file", "filename"},
{ "length", 'l', POPT_ARG_INT|POPT_ARGFLAG_SHOW_DEFAULT, &opt.length, 0, "The length of generated messages", "bytes"},
+ { "userhist", 'u', POPT_ARG_NONE, &opt.userhist, 0, "Generate histogram from userspace timestamps"},
POPT_AUTOHELP
{ NULL, 0, 0, NULL, 0 }
};