From bd296e799bd3eceaa3c3f3db1227f9dba62bb1a1 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 13 Sep 2021 18:07:29 -0400 Subject: runsc: add global profile collection flags Add global flags -profile-{block,cpu,heap,mutex} and -trace which enable collection of the specified profile for the entire duration of a container execution. This provides a way to definitively start profiling before that application starts, rather than attempting to race with an out-of-band `runsc debug`. Note that only the main boot process is profiled. This exposed a bug in Task.traceExecEvent: a crash when tracing and -race are enabled. traceExecEvent is called off of the task goroutine, but uses the Task as a context, which is a violation of the Task contract. Switching to the AsyncContext fixes the issue. Fixes #220 --- runsc/boot/BUILD | 1 + 1 file changed, 1 insertion(+) (limited to 'runsc/boot/BUILD') diff --git a/runsc/boot/BUILD b/runsc/boot/BUILD index b8585c1e9..ff7a5a44b 100644 --- a/runsc/boot/BUILD +++ b/runsc/boot/BUILD @@ -15,6 +15,7 @@ go_library( "limits.go", "loader.go", "network.go", + "profile.go", "strace.go", "vfs.go", ], -- cgit v1.2.3