diff options
Diffstat (limited to 'test/benchmarks/harness')
-rw-r--r-- | test/benchmarks/harness/harness.go | 3 | ||||
-rw-r--r-- | test/benchmarks/harness/util.go | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/test/benchmarks/harness/harness.go b/test/benchmarks/harness/harness.go index e14cce987..5c9d0e01e 100644 --- a/test/benchmarks/harness/harness.go +++ b/test/benchmarks/harness/harness.go @@ -24,7 +24,8 @@ import ( ) var ( - help = flag.Bool("help", false, "print this usage message") + help = flag.Bool("help", false, "print this usage message") + debug = flag.Bool("debug", false, "turns on debug messages for individual benchmarks") ) // Harness is a handle for managing state in benchmark runs. diff --git a/test/benchmarks/harness/util.go b/test/benchmarks/harness/util.go index 86b863f78..aeac7ebff 100644 --- a/test/benchmarks/harness/util.go +++ b/test/benchmarks/harness/util.go @@ -18,6 +18,7 @@ import ( "context" "fmt" "net" + "testing" "gvisor.dev/gvisor/pkg/test/dockerutil" "gvisor.dev/gvisor/pkg/test/testutil" @@ -46,3 +47,11 @@ func DropCaches(machine Machine) error { } return nil } + +// DebugLog prints debug messages if the debug flag is set. +func DebugLog(b *testing.B, msg string, args ...interface{}) { + b.Helper() + if *debug { + b.Logf(msg, args...) + } +} |