Merge pull request #37357 from gmarek/profilinig

Automatic merge from submit-queue (batch tested with PRs 36263, 36755, 37357, 37222, 37524)

Add flag to enable contention profiling in scheduler.

```release-note
Add flag to enable contention profiling in scheduler.
```
This commit is contained in:
Kubernetes Submit Queue
2016-12-02 16:26:47 -08:00
committed by GitHub
9 changed files with 1596 additions and 1528 deletions

View File

@@ -60,6 +60,7 @@ func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.AlgorithmProvider, "algorithm-provider", s.AlgorithmProvider, "The scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders())
fs.StringVar(&s.PolicyConfigFile, "policy-config-file", s.PolicyConfigFile, "File with scheduler policy configuration")
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
fs.BoolVar(&s.EnableContentionProfiling, "contention-profiling", false, "Enable lock contention profiling, if profiling is enabled")
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
fs.StringVar(&s.ContentType, "kube-api-content-type", s.ContentType, "Content type of requests sent to apiserver.")

View File

@@ -24,6 +24,7 @@ import (
"net/http"
"net/http/pprof"
"os"
goruntime "runtime"
"strconv"
"k8s.io/kubernetes/pkg/api/v1"
@@ -103,6 +104,9 @@ func Run(s *options.SchedulerServer) error {
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
if s.EnableContentionProfiling {
goruntime.SetBlockProfileRate(1)
}
}
configz.InstallHandler(mux)
mux.Handle("/metrics", prometheus.Handler())