| 245 | } |
| 246 | |
| 247 | func initDebug(c *cli.Context) { |
| 248 | if !enableDebugFlags { |
| 249 | return |
| 250 | } |
| 251 | |
| 252 | if c.IsSet("debug.pprof") { |
| 253 | profileEndpoint := c.String("debug.pprof") |
| 254 | go func() { |
| 255 | log.Println("listening on", "http://"+profileEndpoint, "for profiler requests") |
| 256 | log.Println("failed to listen on profiler endpoint:", http.ListenAndServe(profileEndpoint, nil)) |
| 257 | }() |
| 258 | } |
| 259 | |
| 260 | // These values can also be affected by environment so set them |
| 261 | // only if argument is specified. |
| 262 | if c.IsSet("debug.mutexproffract") { |
| 263 | runtime.SetMutexProfileFraction(c.Int("debug.mutexproffract")) |
| 264 | } |
| 265 | if c.IsSet("debug.blockprofrate") { |
| 266 | runtime.SetBlockProfileRate(c.Int("debug.blockprofrate")) |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | func InitDirs(c *container.C) error { |
| 271 | if c.Config.StateDirectory == "" { |