]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Merge branch 'master' of rtime.felk.cvut.cz:/can-benchmark
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 1 Dec 2010 15:03:19 +0000 (16:03 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 1 Dec 2010 15:03:19 +0000 (16:03 +0100)
gw-tests/filter-sff.sh
gw-tests/pc.sh [new file with mode: 0755]
latester/latester.c

index f0fe0a88ae07c61bdc73df5b79d694ea3846ed49..a32ea021608a56495bbc3ea5bc7edbabaa674b7c 100755 (executable)
@@ -2,7 +2,7 @@
 
 . lib.sh
 
-ids=$(seq 0 256 2047)
+ids="0 $(seq 255 256 2047)"
 
 main() {
     sshgw 'for i in `seq 0 2047`; do cangw -A -s can0 -d can1 -f $(printf %x $i):c00007ff; done'
diff --git a/gw-tests/pc.sh b/gw-tests/pc.sh
new file mode 100755 (executable)
index 0000000..06601fc
--- /dev/null
@@ -0,0 +1,28 @@
+#!/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
+    
index cb578a11ed716ad591198df47fe7b1acb27199fb..f4185671a1e89196a838cd1572d1ebe7d654e88c 100644 (file)
@@ -60,6 +60,7 @@ struct options {
        FILE *file;
        FILE *histogram;
        int length;
+       int userhist;
 };
 
 struct options opt = {
@@ -228,9 +229,15 @@ static inline unsigned get_msg_latency_us(struct msg_info *mi)
 {
        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;
 }
 
@@ -268,7 +275,7 @@ static inline int sock_get_if_index(int s, const char *if_name)
 
 static inline get_tstamp(struct timespec *ts)
 {
-       clock_gettime(CLOCK_MONOTONIC, ts);
+       clock_gettime(CLOCK_REALTIME, ts);
 }
 
 int send_frame(int socket)
@@ -546,6 +553,7 @@ struct poptOption optionsTable[] = {
        { "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 }
 };