On Saturday, March 31, 2018 at 12:15:34 AM UTC+2, Dave Cheney wrote: > > It looks like you’re stopping the block profile immediately after starting > it. > > Try github.com/pkg/profile which will take care of the plumbing for you.
Thanks Dave for pointing your code. After viewing your code, I corrected my code. f,err :=os.Create("/tmp/test_blocking.prof") if err != nil { log.WithError(err).Fatal("creation of blocking profiler file is failed" ) } runtime.SetBlockProfileRate(1) defer func() { if err := pprof.Lookup("block").WriteTo(f,0); err !=nil { log.WithError(err).Fatal("blocking profiler statistic collecition initialization failed") } f.Close() runtime.SetBlockProfileRate(0) }() Now I am getting block profile information. When I run the go tool pprof, I got nothing in the result. Why? go tool pprof test_blocking.prof Main binary filename not available. Type: delay Entering interactive mode (type "help" for commands, "o" for options) (pprof) top30 Showing nodes accounting for 13.16mins, 100% of 13.16mins total flat flat% sum% cum cum% 13.16mins 100% 100% 13.16mins 100% <unknown> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.