set -e
cd `dirname $0`
-cvs -d :pserver:anonymous@ocera.cvs.sourceforge.net:/cvsroot/ocera checkout -D 2009-06-11 -d ocera-can ocera/components/comm/can
+cvs -d :pserver:anonymous@ocera.cvs.sourceforge.net:/cvsroot/ocera checkout -D 2009-08-26 -d ocera-can ocera/components/comm/can
svn checkout -r 1009 svn://svn.berlios.de/socketcan/trunk socketcan
.PHONY: $(T)
-all: $(T)
+all: $(T) html
$(T):%:
- ./$@ --pdf-only
+ ./$@ -X
+
+.PHONY: html
+html:
+ ./genhtml.py results
while [ $# -gt 0 ]; do
case "$1" in
-p) OPT_PLOT_ONLY=1; shift;;
- --pdf-only) OPT_PDF_ONLY=1; shift;;
+ -X|--no-x11-plot) OPT_NO_X11=1; shift;;
esac
done
PATH=$PWD/../_compiled/bin/:$PATH
RTPRIO=60
+COUNT=10000
boost_irq_prio() {
local PRIO=${1:-50}
CAN_IRQ=`sed -ne '/can/ s/:.*//p' /proc/interrupts`
if [ -n "$CAN_IRQ" ]; then
IRQ_PID=`pidof IRQ-${CAN_IRQ/ /}` || true
- [ -z "$IRQ_PID" ] || schedtool -F -p $PRIO $IRQ_PID
+ if [ -n "$IRQ_PID" ]; then
+ schedtool -F -p $PRIO $IRQ_PID
+ return 0
+ fi
fi
+ return 1
}
rmmod_can() {
run_tests() {
tests=${TESTS:-socketcan_hw lincan_hw}
- for i in $tests; do
- cpufreq-set -f 2400MHz
- boost_irq_prio 50
- prepare_$i
+ for tst in $tests; do
+ boost_irq_prio 50 || true
+ prepare_$tst
t
done
}
plot() {
for i in "${!PLOT_CMD[@]}"; do
- if [ -z "$OPT_PDF_ONLY" ]; then
- echo "set terminal x11 enhanced; ${PLOT_CMD[$i]}" | gnuplot -persist
+ cmd="${PLOT_CMD[$i]}";
+ cmd=$(echo "$cmd" | sed -e "/set title/ s/[\"']\(.*\)[\"']/'\1 ($(uname -r), CPU\\\\@${clk}Mhz)'/")
+ if [ -z "$OPT_NO_X11" ]; then
+ echo "set terminal x11 enhanced; ${cmd}" | gnuplot -persist
fi
I=${i/0/}
echo "set terminal postscript color eps enhanced;
- ${PLOT_CMD[$i]}" | gnuplot | epstopdf --filter > `basename $0 .sh`$I.pdf
+ ${cmd}" | gnuplot | epstopdf --filter > `basename $0 .sh`$I.pdf
+ mkdir -p thumb
+ convert -geometry 1000x100 -gamma 0.3 `basename $0 .sh`$I.pdf thumb/`basename $0 .sh`$I.png
+ convert -density 200 -gamma 0.7 -geometry 1000x500 `basename $0 .sh`$I.pdf `basename $0 .sh`$I.png
done
}
-go() {
- d=results/`basename $0 .sh`/`uname -r`
- set -x
+create_dirs_and_links() {
+ local test=$1
+ local kver=$2
+ local clck=$3
+
+ local d=results/by-test/$test/$kver/$clck
mkdir -p $d
- cd $d
-
- [ -n "$OPT_PLOT_ONLY" ] || run_tests
- plot
+ mkdir -p results/by-test/$test/$clck # 1
+ mkdir -p results/by-kern/$kver/$clck # 2
+ mkdir -p results/by-kern/$kver/$test # 3
+ mkdir -p results/by-clck/$clck/$kver # 4
+ mkdir -p results/by-clck/$clck/$test # 5
+ ln -sfT ../../../${d#results/} results/by-test/$test/$clck/$kver # 1
+ ln -sfT ../../../${d#results/} results/by-kern/$kver/$clck/$test # 2
+ ln -sfT ../../../${d#results/} results/by-kern/$kver/$test/$clck # 3
+ ln -sfT ../../../${d#results/} results/by-clck/$clck/$kver/$test # 4
+ ln -sfT ../../../${d#results/} results/by-clck/$clck/$test/$kver # 5
+ echo $d
+}
+
+go() {
+ mhz=${MHZ:-2400 300}
+ for clk in $mhz; do
+ dir=$(create_dirs_and_links `basename $0 .sh` `uname -r` $clk)
+ set -x
+ pushd $dir
+
+ if [ ! -n "$OPT_PLOT_ONLY" ]; then
+ cpufreq-set -f ${clk}MHz
+ run_tests
+ cpufreq-set -f 2400MHz
+ fi
+ plot
+ popd
+ set +x
+ done
}
. _lib.sh
t() {
- ssh root@${SSH_CONNECTION%% *} 'ping -f "${SSH_CONNECTION%% *}"' &
- PID_PING=$!
- boost_irq_prio
- PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER -t 1 -d $CAN0 -w 2 -c 10000
- kill $PID_S
- kill $PID_PING
+ for i in norm boost; do
+ ssh root@${SSH_CONNECTION%% *} 'ping -f "${SSH_CONNECTION%% *}"' &
+ PID_PING=$!
+ echo 0 1 > $DRIVER-$i-1000.dat
+ if [ $i != "boost" ] || boost_irq_prio 90; then
+ PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
+ vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-$i -t 1 -d $CAN0 -w 2 -c $COUNT
+ kill $PID_S
+ fi
+ kill $PID_PING
+ done
}
PLOT_CMD='
-set title "Round-trip time with ethenet load - ping -f (`uname -r`)"
+set title "Round-trip time with ethernet load - ping -f"
set logscale y
set grid
set xlabel "Time [{/Symbol m}s]"
set ylabel "Latency profile [messages]"
-plot [0:] "socketcan-1000.dat" with lp title "Socketcan",\
- "lincan-1000.dat" with lp title "Lincan"
+plot [0:] "socketcan-norm-1000.dat" with lp lt 1 title "Socketcan",\
+ "lincan-norm-1000.dat" with lp lt 2 title "Lincan",\
+ "socketcan-boost-1000.dat" with lp lt 1 title "Socketcan boosted IRQ prio",\
+ "lincan-boost-1000.dat" with lp lt 2 title "Lincan boosted IRQ prio"
'
. _lib.sh
t() {
- ssh root@${SSH_CONNECTION%% *} 'ping -fs 64000 ${SSH_CONNECTION%% *}' &
- PID_PING=$!
- PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER -t 1 -d $CAN0 -w 2 -c 10000
- kill $PID_S
- kill $PID_PING
+ for i in norm boost; do
+ ssh root@${SSH_CONNECTION%% *} 'ping -fs 64000 ${SSH_CONNECTION%% *}' &
+ PID_PING=$!
+ echo 0 1 > $DRIVER-$i-1000.dat
+ if [ $i != "boost" ] || boost_irq_prio 90; then
+ PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
+ vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-$i -t 1 -d $CAN0 -w 2 -c $COUNT
+ kill $PID_S
+ fi
+ kill $PID_PING
+ done
}
PLOT_CMD='
-set title "Round-trip time with ethenet load - ping -fs 64000 (`uname -r`)"
+set title "Round-trip time with ethernet load - ping -fs 64000"
set logscale y
set grid
set xlabel "Time [{/Symbol m}s]"
set ylabel "Latency profile [messages]"
-plot [0:] "socketcan-1000.dat" with lp title "Socketcan",\
- "lincan-1000.dat" with lp title "Lincan"
+plot [0:] "socketcan-norm-1000.dat" with lp lt 1 title "Socketcan",\
+ "lincan-norm-1000.dat" with lp lt 2 title "Lincan",\
+ "socketcan-boost-1000.dat" with lp lt 1 title "Socketcan boosted IRQ prio",\
+ "lincan-boost-1000.dat" with lp lt 2 title "Lincan boosted IRQ prio"
'
for i in norm boost; do
ssh root@${SSH_CONNECTION%% *} 'find -L /usr/src/linux -type f -exec cat "{}" ";"' > /dev/null &
PID_LOAD=$!
- [ $i == "boost" ] && boost_irq_prio 90
- PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-$i -t 1 -d $CAN0 -w 0 -c 10000
- kill $PID_S
+ echo 0 1 > $DRIVER-$i-1000.dat
+ if [ $i != "boost" ] || boost_irq_prio 90; then
+ PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
+ vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-$i -t 1 -d $CAN0 -w 0 -c $COUNT
+ kill $PID_S
+ fi
kill $PID_LOAD
done
}
PLOT_CMD='
-set title "Round-trip time with receive ethenet load (`uname -r`)"
+set title "Round-trip time with receive ethernet load"
set logscale y
set grid
set xlabel "Time [{/Symbol m}s]"
+++ /dev/null
-#!/bin/bash
-
-. _lib.sh
-
-t() {
- for i in norm boost; do
- ssh root@${SSH_CONNECTION%% *} 'find -L /usr/src/linux -type f -exec cat "{}" ";"' > /dev/null &
- PID_LOAD=$!
- [ $i == "boost" ] && boost_irq_prio 90
- cpufreq-set -f 300MHz
- PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-$i -t 1 -d $CAN0 -w 0 -c 10000
- cpufreq-set -f 2400MHz
- kill $PID_S
- kill $PID_LOAD
- done
-}
-
-
-
-PLOT_CMD='
-set title "Round-trip time with receive ethenet load (`uname -r`, CPU\\@300 MHz)"
-set logscale y
-set grid
-set xlabel "Time [{/Symbol m}s]"
-set ylabel "Latency profile [messages]"
-plot [0:] "socketcan-norm-1000.dat" with lp lt 1 title "Socketcan",\
- "lincan-norm-1000.dat" with lp lt 2 title "Lincan",\
- "socketcan-boost-1000.dat" with lp lt 1 title "Socketcan boosted IRQ prio",\
- "lincan-boost-1000.dat" with lp lt 2 title "Lincan boosted IRQ prio"
-'
. _lib.sh
t() {
- ( find -L /usr/src/linux -type f -exec cat '{}' ';'|ssh root@${SSH_CONNECTION%% *} 'cat > /dev/null' ) &
+ find -L /usr/src/linux -type f -exec cat '{}' ';'|ssh root@${SSH_CONNECTION%% *} 'cat > /dev/null' &
PID_LOAD=$!
PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
- vca_canping -m 1 -R FF:$RTPRIO FF:$RTPRIO -v -g $DRIVER -t 1 -d $CAN0 -w 2 -c 10000
+ vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER -t 1 -d $CAN0 -w 0 -c $COUNT
kill $PID_S
- kill $PID_LOAD
+ kill %% # Kill the whole pipe above
}
PLOT_CMD='
-set title "Round-trip time with receive ethenet load (`uname -r`)"
+set title "Round-trip time with send ethernet load"
set logscale y
set grid
set xlabel "Time [{/Symbol m}s]"
--- /dev/null
+#!/usr/bin/env python
+
+import os;
+import dircache;
+import sys;
+
+os.chdir(sys.argv[1])
+
+class Axis:
+ def __init__(self, atype):
+ self.type = atype
+ self.values = dircache.listdir('by-%s'%atype)
+
+ def __str__(self):
+ if self.type == "kern": return "kernel"
+ elif self.type == "clck": return "CPU clock"
+ elif self.type == "test": return "test"
+ else: raise Exception, "Unknown type"
+
+ def __iter__(self):
+ return iter(self.values)
+
+ def __getitem__(self, key):
+ return self.values[key]
+
+ def getLabel(self, v):
+ if self.type == "clck": return v+" MHz"
+ elif self.type == "test": return "<a href='%s.sh.html'>%s</a>"%(v, v)
+ else: return v
+
+
+ def labels(self):
+ for v in self.values:
+ yield self.getLabel(v)
+
+kernels = Axis('kern')
+clocks = Axis('clck')
+tests = Axis('test')
+
+class PageSet:
+ def __init__(self, values, x, y):
+ self.values = values
+ self.x = x
+ self.y = y
+
+ def getPages(self):
+ for v in self.values:
+ yield Page(self.values.type, str(self.values), v, self.x, self.y)
+
+class Page:
+ def __init__(self, prefix, name, value, xvals, yvals):
+ self.prefix = prefix
+ self.name = name
+ self.value = value
+ self.xvals = xvals
+ self.yvals = yvals
+
+ def generate(self, pagesets):
+ html = open("%s-%s.html"%(self.prefix, self.value), "w")
+ print >> html, """<html>
+<head>
+<title>CAN driver benchmark for %s %s</title>
+<style>
+img { border: 0; }
+table { border-collapse: collapse; }
+td { border: 1px solid lightgray; padding: 4px;}
+</style>
+</head>
+<body>
+<h1>CAN driver benchmark for %s %s</h1>""" % (self.name, self.value, self.name, self.value)
+ for ps in pagesets:
+ print >>html, "View by %s: " % str(ps.values)
+ for v in ps.values:
+ print >>html, "<a href='%s-%s.html'>%s</a> | "%(ps.values.type, v, v)
+ print >>html, "<br>"
+ print >>html, "<table><thead><tr><td> </td>"
+ for x in self.xvals.labels():
+ print >>html, "<td>%s</td>" % x
+ print >>html, "</tr></thead>"
+ for y in self.yvals:
+ print >>html, "<tr><td>%s</td>" % self.yvals.getLabel(y)
+
+ for x in self.xvals:
+ print >>html, "<td>"
+ d="by-%s/%s/%s/%s/" % (self.prefix, self.value, y, x)
+ dthumb = d+"thumb"
+ try:
+ for img in dircache.listdir(dthumb):
+ print >>html, "<a href='%s/%s'><img src='%s/thumb/%s'></a>" % (d, img, d, img)
+ except OSError:
+ print "error"
+ print >>html, "</td>"
+ print >>html, "</tr>"
+ print >> html, """
+</table>
+</body>
+"""
+
+
+pagesets = [ PageSet(kernels, clocks, tests),
+ PageSet(tests, clocks, kernels),
+ PageSet(clocks, kernels, tests)]
+
+for ps in pagesets:
+ for p in ps.getPages():
+ p.generate(pagesets)
+
+try:
+ os.remove("index.html")
+except OSError: pass
+
+os.symlink("%s-%s.html"%(kernels.type, kernels[0]), "index.html")
+
+os.system("source-highlight -d --output-dir=. ../*.sh")
+
+
+
+++ /dev/null
-#!/bin/bash
-
-. _lib.sh
-
-t() {
- PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
- cpufreq-set -f 300MHz
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER -t 1 -d $CAN0 -w 2 -c 10000
- cpufreq-set -f 2400Mhz
- kill $PID_S
-}
-
-
-
-PLOT_CMD='
-set title "Round-trip time (`uname -r`, CPU\\@300 MHz)"
-set logscale y
-set grid
-set xlabel "Time [{/Symbol m}s]"
-set ylabel "Latency profile [messages]"
-plot [0:] "socketcan-1000.dat" with lp title "Socketcan",\
- "lincan-1000.dat" with lp title "Lincan"
-'
-
+++ /dev/null
-#!/bin/bash
-
-. _lib.sh
-
-t() {
- PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN0`
- cpufreq-set -f 300MHz
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER -t 1 -d $CAN0 -w 5 -c 10000
- cpufreq-set -f 2400MHz
- kill $PID_S
-}
-
-TESTS="lincan_virtual socketcan_virtual"
-
-PLOT_CMD='
-set title "Round-trip time - virtual CAN (`uname -r`, CPU\\@300 MHz)"
-set logscale y
-set grid
-set xlabel "Time [{/Symbol m}s]"
-set ylabel "Latency profile [messages]"
-plot [0:] "socketcan-virtual-1000.dat" with lp title "Socketcan",\
- "lincan-virtual-1000.dat" with lp title "Lincan"
-'
-
t() {
PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN0`
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER -t 1 -d $CAN0 -w 0 -c 10000
+ vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER -t 1 -d $CAN0 -w 0 -c $COUNT
kill $PID_S
}
TESTS="lincan_virtual socketcan_virtual"
PLOT_CMD='
-set title "Round-trip time - virtual CAN (`uname -r`)"
+set title "Round-trip time - virtual CAN"
set logscale y
set grid
set xlabel "Time [{/Symbol m}s]"
t() {
PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-0 -t 1 -d $CAN0 -w 0 -n 10 -c 10000
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-1 -t 1 -d $CAN0 -w 1 -n 10 -c 10000
- vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-2 -t 1 -d $CAN0 -w 2 -n 10 -c 10000
+ vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-0 -t 1 -d $CAN0 -w 0 -n 10 -c $COUNT
+ vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-1 -t 1 -d $CAN0 -w 1 -n 10 -c $COUNT
+ vca_canping -m 1 -R FF:$RTPRIO -v -g $DRIVER-2 -t 1 -d $CAN0 -w 2 -n 10 -c $COUNT
kill $PID_S
}
PLOT_CMD='
-set title "Round-trip time depending on delay between sends (`uname -r`)"
+set title "Round-trip time depending on delay between sends"
set logscale y
set grid
set xlabel "Time [{/Symbol m}s]"
t() {
PID_S=`vca_canping -s 1 -b -R FF:$RTPRIO -d $CAN1`
- vca_canping -m 1 -R FF:$RTPRIO -v -e $DRIVER-times -g $DRIVER -t 1 -d $CAN0 -w 0 -n 10 -c 10000
+ vca_canping -m 1 -R FF:$RTPRIO -v -e $DRIVER-times -g $DRIVER -t 1 -d $CAN0 -w 0 -n 10 -c $COUNT
kill $PID_S
}
PLOT_CMD='
-set title "Round-trip time (`uname -r`)"
+set title "Round-trip time"
set logscale y
set grid
set xlabel "Time [{/Symbol m}s]"
'
PLOT_CMD[1]='
-set title "Round-trip time history (`uname -r`)"
-set logscale y
+set title "Round-trip time history"
+set logscale xy
set grid
set xlabel "Ping number"
set ylabel "Round-trip time [{/Symbol m}s]"