Skip to content

Commit db0c9e8

Browse files
EtiennePerotgvisor-bot
authored andcommitted
iperf: Fix benchmark for low b.N values and parallelization enabled.
PiperOrigin-RevId: 785546900
1 parent 3040753 commit db0c9e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/benchmarks/tools/iperf.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ func (i *Iperf) MakeCmd(host string, port int) []string {
3535
cmd = append(cmd, "--len", "128K") // Length of data buffer per request.
3636
n := i.Num
3737
if i.Parallel > 0 {
38-
n = i.Num / i.Parallel
38+
// Must be at least 1, otherwise iperf will complain about having nothing to transmit.
39+
n = max(i.Num/i.Parallel, 1)
3940
}
4041
cmd = append(cmd, "--num", fmt.Sprintf("%dK", n)) // Number of requests to send.
4142
cmd = append(cmd, "--client", host)

0 commit comments

Comments
 (0)