diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-06-25 21:40:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-25 21:40:38 +0200 |
commit | 5b7086abda91f4301af3bfb642d416a22349c276 (patch) | |
tree | bf139f29b261e55c161394637f1c7073da5103f0 /vendor/github.com/pkg/profile/profile.go | |
parent | a488e197a6e3947dd420b40ed834b50db9c829c3 (diff) | |
parent | 2388222e98462fdbbe44f3e091b2b79d80956a9a (diff) | |
download | podman-5b7086abda91f4301af3bfb642d416a22349c276.tar.gz podman-5b7086abda91f4301af3bfb642d416a22349c276.tar.bz2 podman-5b7086abda91f4301af3bfb642d416a22349c276.zip |
Merge pull request #3418 from vrothberg/go-modules
update dependencies
Diffstat (limited to 'vendor/github.com/pkg/profile/profile.go')
-rw-r--r-- | vendor/github.com/pkg/profile/profile.go | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/vendor/github.com/pkg/profile/profile.go b/vendor/github.com/pkg/profile/profile.go index c44913a4c..20e285427 100644 --- a/vendor/github.com/pkg/profile/profile.go +++ b/vendor/github.com/pkg/profile/profile.go @@ -19,6 +19,7 @@ const ( mutexMode blockMode traceMode + threadCreateMode ) // Profile represents an active profiling session. @@ -83,17 +84,20 @@ func MemProfileRate(rate int) func(*Profile) { // MutexProfile enables mutex profiling. // It disables any previous profiling settings. -// -// Mutex profiling is a no-op before go1.8. func MutexProfile(p *Profile) { p.mode = mutexMode } // BlockProfile enables block (contention) profiling. // It disables any previous profiling settings. func BlockProfile(p *Profile) { p.mode = blockMode } -// Trace profile controls if execution tracing will be enabled. It disables any previous profiling settings. +// Trace profile enables execution tracing. +// It disables any previous profiling settings. func TraceProfile(p *Profile) { p.mode = traceMode } +// ThreadcreationProfile enables thread creation profiling.. +// It disables any previous profiling settings. +func ThreadcreationProfile(p *Profile) { p.mode = threadCreateMode } + // ProfilePath controls the base path where various profiling // files are written. If blank, the base path will be generated // by ioutil.TempDir. @@ -211,6 +215,21 @@ func Start(options ...func(*Profile)) interface { logf("profile: block profiling disabled, %s", fn) } + case threadCreateMode: + fn := filepath.Join(path, "threadcreation.pprof") + f, err := os.Create(fn) + if err != nil { + log.Fatalf("profile: could not create thread creation profile %q: %v", fn, err) + } + logf("profile: thread creation profiling enabled, %s", fn) + prof.closer = func() { + if mp := pprof.Lookup("threadcreate"); mp != nil { + mp.WriteTo(f, 0) + } + f.Close() + logf("profile: thread creation profiling disabled, %s", fn) + } + case traceMode: fn := filepath.Join(path, "trace.out") f, err := os.Create(fn) |