mirror of
https://github.com/containers/podman.git
synced 2025-06-25 12:20:42 +08:00
Merge pull request #11308 from vrothberg/profiling
profiling: higher memory sampling rate
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/common/pkg/completion"
|
"github.com/containers/common/pkg/completion"
|
||||||
@ -194,6 +195,17 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
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 {
|
if cfg.MaxWorks <= 0 {
|
||||||
return errors.Errorf("maximum workers must be set to a positive number (got %d)", cfg.MaxWorks)
|
return errors.Errorf("maximum workers must be set to a positive number (got %d)", cfg.MaxWorks)
|
||||||
|
Reference in New Issue
Block a user