summaryrefslogtreecommitdiffhomepage
path: root/test/benchmarks/tools/iperf.go
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2020-12-29 18:26:46 -0800
committergVisor bot <gvisor-bot@google.com>2020-12-29 18:29:12 -0800
commitffa9a715aaf4ebc4c8d8bef948649af358e4f4e4 (patch)
tree47e16fdc85a56d00f8c8e5380cfc28a44957f877 /test/benchmarks/tools/iperf.go
parent3c58405a544dcd599bd84406b5d52848941675f7 (diff)
Simplify profiling and benchmarks.
- Tweak the benchmarks to work with b.N where appropriate. In many cases, b.N was simply being ignored. This creates an implicit dependency in the user passing a reasonable benchtime (less than or equal to the actual runtime of the test, or using the X syntax) otherwise the test runs forever. - In cases where the above is impossible, explicitly set benchtime from the test wrapper, to prevent the above behavior (tensorflow). - Drop the *Reverse variants, which are simply hey benchmarks. We should just add a hey benchmark. The platforms benchmarks already include a native platform, and thus these benchmarks are incredibly confusing. (In other words, BenchmarkNginxReverse has nothing to do with an nginx benchmark for runsc.) - Remove the redunant Harness object, which contains no state, in order to slightly simplify the code. - Make Block and Heap profiling actually work, but setting appropriate runtime parameters (and plumbing them through the config). - Split the profiling into two phases: start and stop, since some will need to be started early, and others will need to happen at the end. PiperOrigin-RevId: 349495377
Diffstat (limited to 'test/benchmarks/tools/iperf.go')
-rw-r--r--test/benchmarks/tools/iperf.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/benchmarks/tools/iperf.go b/test/benchmarks/tools/iperf.go
index 891d32704..abf296731 100644
--- a/test/benchmarks/tools/iperf.go
+++ b/test/benchmarks/tools/iperf.go
@@ -19,19 +19,27 @@ import (
"net"
"regexp"
"strconv"
- "strings"
"testing"
)
+const length = 64 * 1024
+
// Iperf is for the client side of `iperf`.
type Iperf struct {
- Time int
+ Num int
}
// MakeCmd returns a iperf client command.
func (i *Iperf) MakeCmd(ip net.IP, port int) []string {
- // iperf report in Kb realtime
- return strings.Split(fmt.Sprintf("iperf -f K --realtime --time %d --client %s --port %d", i.Time, ip, port), " ")
+ return []string{
+ "iperf",
+ "--format", "K", // Output in KBytes.
+ "--realtime", // Measured in realtime.
+ "--num", fmt.Sprintf("%d", i.Num),
+ "--length", fmt.Sprintf("%d", length),
+ "--client", ip.String(),
+ "--port", fmt.Sprintf("%d", port),
+ }
}
// Report parses output from iperf client and reports metrics.
@@ -42,6 +50,7 @@ func (i *Iperf) Report(b *testing.B, output string) {
if err != nil {
b.Fatalf("failed to parse bandwitdth from %s: %v", output, err)
}
+ b.SetBytes(length) // Measure Bytes/sec for b.N, although below is iperf output.
ReportCustomMetric(b, bW*1024, "bandwidth" /*metric name*/, "bytes_per_second" /*unit*/)
}