summaryrefslogtreecommitdiffstats
path: root/fwbench.sh
blob: efe0cb20006e39113fb0d30c0d0f4f18604c214b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/bash

function fwbench {
    if [ -f ../configure.sh -a -f fwbench ]; then
	../configure.sh ./fwbench $*
    elif [ -f fwbench ]; then
	./fwbench $*
    else
	`which fwbench` $*
    fi
}


if [ -n "$1" ]; then
    out=$1
else
    out="/dev/null"
fi

if [ -n "$2" ]; then
    size=$2
else
    size=1024
fi

if [ -n "$3" ]; then
    speed=$3
else
    speed=1500
fi


speed=$((speed + 50))
res=1
while [ $res -ne 0 ]; do
    speed=$((speed - 50))
    fwbench -b 1024 -m 0 -u 512 -r $speed -s $size -o $out
    res=$?
    usleep 500000
done

echo "Maximal speed: $speed"