diff options
author | Zach Koopmans <zkoopmans@google.com> | 2020-07-26 22:01:16 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-26 22:02:51 -0700 |
commit | 2ecf66903ed3da46fa021feeeeccad81cd82eaa6 (patch) | |
tree | bcbccbcc031169bb2761549731ebf924466ae909 /test/benchmarks/harness/machine.go | |
parent | b38bae00885ef1bc97ff2798917e286bc14ca2f0 (diff) |
Add profiling to dockerutil
Adds profiling with `runsc debug` or pprof to dockerutil. All
targets using dockerutil should now be able to use profiling.
In addition, modifies existing benchmarks to use profiling.
PiperOrigin-RevId: 323298634
Diffstat (limited to 'test/benchmarks/harness/machine.go')
-rw-r--r-- | test/benchmarks/harness/machine.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/benchmarks/harness/machine.go b/test/benchmarks/harness/machine.go index 93c0db9ce..88e5e841b 100644 --- a/test/benchmarks/harness/machine.go +++ b/test/benchmarks/harness/machine.go @@ -25,9 +25,14 @@ import ( // Machine describes a real machine for use in benchmarks. type Machine interface { - // GetContainer gets a container from the machine, + // GetContainer gets a container from the machine. The container uses the + // runtime under test and is profiled if requested by flags. GetContainer(ctx context.Context, log testutil.Logger) *dockerutil.Container + // GetNativeContainer gets a native container from the machine. Native containers + // use runc by default and are not profiled. + GetNativeContainer(ctx context.Context, log testutil.Logger) *dockerutil.Container + // RunCommand runs cmd on this machine. RunCommand(cmd string, args ...string) (string, error) @@ -47,6 +52,11 @@ func (l *localMachine) GetContainer(ctx context.Context, logger testutil.Logger) return dockerutil.MakeContainer(ctx, logger) } +// GetContainer implements Machine.GetContainer for localMachine. +func (l *localMachine) GetNativeContainer(ctx context.Context, logger testutil.Logger) *dockerutil.Container { + return dockerutil.MakeNativeContainer(ctx, logger) +} + // RunCommand implements Machine.RunCommand for localMachine. func (l *localMachine) RunCommand(cmd string, args ...string) (string, error) { c := exec.Command(cmd, args...) |