]> rtime.felk.cvut.cz Git - can-benchmark.git/blob - continuous/gw-setup/run.pl
latester: Add statistics about data out of histogram range
[can-benchmark.git] / continuous / gw-setup / run.pl
1 #!/usr/bin/perl -w
2
3 use FindBin;
4 use Expect;
5
6 # Create startup script in ramdisk
7 my $S99 = "$FindBin::Bin/initramfs/etc/init.d/S99benchmark";
8 system("rm -f $S99");
9 system("cat > $S99; chmod +x $S99") unless -t STDIN;
10
11 # Boot the gateway
12 # die("No boot command") if ($#ARGV eq -1);
13 my $bootcmd = scalar @ARGV ? "'".join("' '", @ARGV)."'" : "$FindBin::Bin/boot";
14 $exp = Expect->spawn($bootcmd) or die "Cannot spawn $bootcmd: $!";
15 $exp->expect(120,
16              'Welcome to Buildroot',
17              'UGW started',
18              '-re', 't...a...s...k...s... ...s...t...a...r...t...e...d') # RTEMS has bug - it sends 4 characters instead of just one
19     or die("Boot failed");
20
21 # Measure latencies
22 my $latester = '
23 set -e
24 rm -f tmp-stat.txt
25 echo "Starting latester"
26 sudo /sbin/ifdown eth0
27 r=0
28 sudo ~/bin/latester -d can0 -d can1 -d can2 -c 3200 -q --oneattime -n tmp || r=$?
29 sudo /sbin/ifup eth0
30 source tmp-stat.txt
31 for i in sent lost enobufs $(seq -f percentile%g 0 10 100); do keyval="$keyval $i=$((i))"; done
32 echo "! PERF: gw_latency $avg µs $keyval ok"
33 test $avg -eq 0 && exit 1
34 exit $r
35 ';
36
37 my $status = system((qw(ssh -T glab), $latester));
38 $exp->close();
39 exit($status >> 8);