File: find_max_burst.sh

package info (click to toggle)
netperf 2.7.0-0.1
  • links: PTS
  • area: non-free
  • in suites: bookworm, bullseye
  • size: 8,840 kB
  • sloc: ansic: 41,631; sh: 5,259; xml: 3,129; python: 2,376; awk: 68; makefile: 66
file content (42 lines) | stat: -rwxr-xr-x 967 bytes parent folder | download
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
# a crude script to try to find the burst size which results in
# something approximating peak transactions per second.  once we
# pass the peak, we may want to refine further but for now, this
# should suffice

LAST_TPS=0
BURST=1
LAST_BURST=0
NETPERF=${NETPERF:="netperf"}

TMP_TPS=`$NETPERF -t UDP_RR -P 0 -H $1 -- -b $BURST -D -o throughput -e 1 -s 1M -S 1M`

if [ $? -ne 0 ]
then
    echo -1
    exit -1
fi

CUR_TPS=`echo $TMP_TPS | awk '{print int($1)}'`

while [ $CUR_TPS -gt $LAST_TPS ]
do
    LAST_BURST=$BURST
    BURST=`expr $BURST \* 2`
    LAST_TPS=$CUR_TPS

    TMP_TPS=`$NETPERF -t UDP_RR -P 0 -H $1 -- -b $BURST -D -o throughput -e 1 -s 1M -S 1M`

    if [ $? -ne 0 ]
    then
	echo -1
	exit -1
    fi

    CUR_TPS=`echo $TMP_TPS | awk '{print int($1)}'`
done

# if we were going to further refine the estimate we would probably do
# a binary search at this point but for now, just emit the value of
# LAST_BURST and be done with it.

echo $LAST_BURST