Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runsc: add global profile collection flags #6579

Merged
merged 2 commits into from
Sep 16, 2021

Conversation

prattmic
Copy link
Member

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.

Fixes #220

@ayushr2
Copy link
Collaborator

ayushr2 commented Sep 15, 2021

Thanks for doing this! Being able to directly profile for the duration of a container execution will be really useful.
I think this change is submitting, but it just hit me that we should update our website about profiling: https://gvisor.dev/docs/user_guide/debugging/

Also @zkoopmans you might be interested in this change, afaik the current benchmarking library uses runsc debug and parallely runs the container. This might be a better way of collecting profiles.

@prattmic
Copy link
Member Author

@ayushr2 updating the website is a good idea. I'll send another PR for that.

copybara-service bot pushed a commit that referenced this pull request Sep 15, 2021
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.

Fixes #220

FUTURE_COPYBARA_INTEGRATE_REVIEW=#6579 from prattmic:runsc_do_profile ad052b71469658032cff5f8a95f482156976c66f
PiperOrigin-RevId: 396660344
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 google#220
@copybara-service copybara-service bot merged commit eb07b91 into google:master Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes CLA has been signed ready to pull
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve runsc profile collection
3 participants