diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-08-23 13:33:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-23 13:33:19 -0400 |
commit | f9d706bc4982255f40a77ee3dcfb8e3369570ccc (patch) | |
tree | f7b927f7d7e89640ec4255b6bd50ba61007aa2c2 /cmd/podman/root.go | |
parent | ac5f2e1162a4a04c171c4ae6209f71d14371bf30 (diff) | |
parent | 7b54a5fbe861298d554b201b508250f62609cc56 (diff) | |
download | podman-f9d706bc4982255f40a77ee3dcfb8e3369570ccc.tar.gz podman-f9d706bc4982255f40a77ee3dcfb8e3369570ccc.tar.bz2 podman-f9d706bc4982255f40a77ee3dcfb8e3369570ccc.zip |
Merge pull request #11308 from vrothberg/profiling
profiling: higher memory sampling rate
Diffstat (limited to 'cmd/podman/root.go')
-rw-r--r-- | cmd/podman/root.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go index 1275f5631..371ded9a8 100644 --- a/cmd/podman/root.go +++ b/cmd/podman/root.go @@ -6,6 +6,7 @@ import ( "path/filepath" "runtime" "runtime/pprof" + "strconv" "strings" "github.com/containers/common/pkg/completion" @@ -194,6 +195,17 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error { return err } } + if cmd.Flag("memory-profile").Changed { + // Same value as the default in github.com/pkg/profile. + runtime.MemProfileRate = 4096 + if rate := os.Getenv("MemProfileRate"); rate != "" { + r, err := strconv.Atoi(rate) + if err != nil { + return err + } + runtime.MemProfileRate = r + } + } if cfg.MaxWorks <= 0 { return errors.Errorf("maximum workers must be set to a positive number (got %d)", cfg.MaxWorks) |