util: enable golang profiling

Add support for golang profiling.
Standard tools like go tool pprof and curl
work. example:
$ go tool pprof http://localhost:8080/debug/pprof/profile
$ go tool pprof http://localhost:8080/debug/pprof/heap
$ curl http://localhost:8080/debug/pprof/heap?debug=1

https://golang.org/pkg/net/http/pprof/ contains
more details about the pprof interface.

Fixes: #1699

Signed-off-by: Yati Padia <ypadia@redhat.com>
This commit is contained in:
Yati Padia
2021-03-25 16:44:46 +05:30
committed by mergify[bot]
parent 9aa3520c9d
commit 774e8e4042
15 changed files with 67 additions and 0 deletions

View File

@ -90,6 +90,7 @@ func init() {
"skip image flattening if kernel support mapping of rbd images which has the deep-flatten feature")
flag.BoolVar(&conf.Version, "version", false, "Print cephcsi version information")
flag.BoolVar(&conf.EnableProfiling, "enableprofiling", false, "enable go profiling")
klog.InitFlags(nil)
if err := flag.Set("logtostderr", "true"); err != nil {