From b06e5bc5b0913d3740b435d8753a2569220e0a33 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Tue, 5 Jan 2021 13:20:12 -0800 Subject: Add benchmarks targets to BuildKite. This includes minor fix-ups: * Handle SIGTERM in runsc debug, to exit gracefully. * Fix cmd.debug.go opening all profiles as RDONLY. * Fix the test name in fio_test.go, and encode the block size in the test. PiperOrigin-RevId: 350205718 --- pkg/test/dockerutil/profile.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'pkg/test/dockerutil/profile.go') diff --git a/pkg/test/dockerutil/profile.go b/pkg/test/dockerutil/profile.go index f1103eb6e..5cad3e959 100644 --- a/pkg/test/dockerutil/profile.go +++ b/pkg/test/dockerutil/profile.go @@ -38,12 +38,19 @@ type profile struct { } // profileInit initializes a profile object, if required. -func (c *Container) profileInit() { +// +// N.B. The profiling filename initialized here will use the *image* +// name, and not the unique container name. This is intentional. Most +// of the time, profiling will be used for benchmarks. Benchmarks will +// be run iteratively until a sufficiently large N is reached. It is +// useful in this context to overwrite previous runs, and generate a +// single profile result for the final test. +func (c *Container) profileInit(image string) { if !*pprofBlock && !*pprofCPU && !*pprofMutex && !*pprofHeap { return // Nothing to do. } c.profile = &profile{ - BasePath: filepath.Join(*pprofBaseDir, c.runtime, c.Name), + BasePath: filepath.Join(*pprofBaseDir, c.runtime, c.logger.Name(), image), Duration: *pprofDuration, } if *pprofCPU { @@ -83,6 +90,7 @@ func (p *profile) createProcess(c *Container) error { args = append(args, fmt.Sprintf("--profile-%s=%s", profileArg, outputPath)) } 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()) // Best effort wait until container is running. @@ -104,8 +112,6 @@ func (p *profile) createProcess(c *Container) error { } // killProcess kills the process, if running. -// -// Precondition: mu must be held. func (p *profile) killProcess() error { if p.cmd != nil && p.cmd.Process != nil { return p.cmd.Process.Signal(syscall.SIGTERM) @@ -114,8 +120,6 @@ func (p *profile) killProcess() error { } // waitProcess waits for the process, if running. -// -// Precondition: mu must be held. func (p *profile) waitProcess() error { defer func() { p.cmd = nil }() if p.cmd != nil { -- cgit v1.2.3