diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-03-11 11:46:18 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-03-11 11:47:30 -0700 |
commit | bc9b979b9412ad5852872c1a9bee462f73d2455e (patch) | |
tree | ca7fda751568879d4ef08aee53d3a8298e1faf55 /runsc/boot/controller.go | |
parent | 71d53382bfb3a6f05e90e31df8f39d22c0131040 (diff) |
Add profiling commands to runsc
Example:
runsc debug --root=<dir> \
--profile-heap=/tmp/heap.prof \
--profile-cpu=/tmp/cpu.prod --profile-delay=30 \
<container ID>
PiperOrigin-RevId: 237848456
Change-Id: Icff3f20c1b157a84d0922599eaea327320dad773
Diffstat (limited to 'runsc/boot/controller.go')
-rw-r--r-- | runsc/boot/controller.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runsc/boot/controller.go b/runsc/boot/controller.go index 23d476f7f..a864be720 100644 --- a/runsc/boot/controller.go +++ b/runsc/boot/controller.go @@ -95,6 +95,11 @@ const ( // SandboxStacks collects sandbox stacks for debugging. SandboxStacks = "debug.Stacks" + + // Profiling related commands (see pprof.go for more details). + StartCPUProfile = "Profile.StartCPUProfile" + StopCPUProfile = "Profile.StopCPUProfile" + HeapProfile = "Profile.HeapProfile" ) // ControlSocketAddr generates an abstract unix socket name for the given ID. @@ -135,6 +140,9 @@ func newController(fd int, l *Loader) (*controller, error) { } srv.Register(&debug{}) + if l.conf.ProfileEnable { + srv.Register(&control.Profile{}) + } return &controller{ srv: srv, |