Skip to content

Commit

Permalink
Enable collection of go traces during benchmarks.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 601548685
  • Loading branch information
manninglucas authored and gvisor-bot committed Jan 25, 2024
1 parent d788c40 commit 8d37113
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/test/dockerutil/dockerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var (
pprofCPU = flag.Bool("pprof-cpu", false, "enables CPU profiling with runsc debug")
pprofHeap = flag.Bool("pprof-heap", false, "enables heap profiling with runsc debug")
pprofMutex = flag.Bool("pprof-mutex", false, "enables mutex profiling with runsc debug")
trace = flag.Bool("go-trace", false, "enables collecting a go trace with runsc debug")

// This matches the string "native.cgroupdriver=systemd" (including optional
// whitespace), which can be found in a docker daemon configuration file's
Expand Down
3 changes: 3 additions & 0 deletions pkg/test/dockerutil/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func (p *profile) createProcess(c *Container) error {
outputPath := filepath.Join(p.BasePath, fmt.Sprintf("%s.pprof", profileArg))
args = append(args, fmt.Sprintf("--profile-%s=%s", profileArg, outputPath))
}
if *trace {
args = append(args, fmt.Sprintf("--trace=%s", filepath.Join(p.BasePath, "sentry.trace")))
}
args = append(args, fmt.Sprintf("--duration=%s", p.Duration)) // Or until container exits.
args = append(args, fmt.Sprintf("--delay=%s", p.Duration)) // Ditto.
args = append(args, c.ID())
Expand Down

0 comments on commit 8d37113

Please sign in to comment.