#!/bin/sh N=100 MODE=oneattime SLEEP=1 LOGANDPRINT="tee -a result | cut -c 2-" RESULTFILE=/dev/null SENDRES=0 if test $# -eq 1; then RESULTFILE=$1 SENDRES=1 fi #----------------- # bench kernel #----------------- modprobe canethgw cegw --listen udp@127.0.0.1:10501 cegw --add -s can@vcan0 -d udp@127.0.0.1:10502 cegw --add -s udp@127.0.0.1:10502 -d can@vcan0 sleep $SLEEP echo "#kernel udp->can: " | tee -a result | cut -c 2- cegwbench -s udp@127.0.0.1:10501 -d can@vcan0 -n $N -m $MODE -t 1 >> $RESULTFILE sleep $SLEEP echo "#kernel can->udp: " | tee -a result | cut -c 2- cegwbench -s can@vcan0 -d udp@127.0.0.1:10502 -n $N -m $MODE -t 1 >> $RESULTFILE sleep $SLEEP modprobe -r canethgw #----------------- # bench user #----------------- canethgw -s can@vcan0 -d udp@127.0.0.1:10502 -l udp@127.0.0.1:10501 & PID=$! sleep $SLEEP echo "#user udp->can: " | tee -a result | cut -c 2- cegwbench -s udp@127.0.0.1:10501 -d can@vcan0 -n $N -m $MODE -t 1 >> $RESULTFILE sleep $SLEEP echo "#user can->udp: " | tee -a result | cut -c 2- cegwbench -s can@vcan0 -d udp@127.0.0.1:10502 -n $N -m $MODE -t 1 >> $RESULTFILE sleep $SLEEP kill -2 $PID # send result if test $SENDRES -eq 1; then cat $RESULTFILE | nc `cat /etc/retip` 10600 fi