Make b.N increase by KB not bytes on iperf.

Currently, iperf runs a client that scales by
bytes sent. In practice, this causes b.N to scale
slowly and have several short lived containers.

Instead, scale by KB to more quickly reach required time.

PiperOrigin-RevId: 358244926
This commit is contained in:
Zach Koopmans
2021-02-18 13:01:44 -08:00
committed by gVisor bot
parent 2a2cb29e1c
commit ec20f4f38e
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ func BenchmarkIperf(b *testing.B) {
}
iperf := tools.Iperf{
Num: b.N,
Num: b.N, // KB for the client to send.
}
// Run the client.
+3 -3
View File
@@ -26,7 +26,7 @@ const length = 64 * 1024
// Iperf is for the client side of `iperf`.
type Iperf struct {
Num int
Num int // Number of bytes to send in KB.
}
// MakeCmd returns a iperf client command.
@@ -34,8 +34,8 @@ func (i *Iperf) MakeCmd(ip net.IP, port int) []string {
return []string{
"iperf",
"--format", "K", // Output in KBytes.
"--realtime", // Measured in realtime.
"--num", fmt.Sprintf("%d", i.Num),
"--realtime", // Measured in realtime.
"--num", fmt.Sprintf("%dK", i.Num), // Number of bytes to send in KB.
"--length", fmt.Sprintf("%d", length),
"--client", ip.String(),
"--port", fmt.Sprintf("%d", port),