MCPcopy
hub / github.com/etcd-io/bbolt / stopProfiling

Function stopProfiling

cmd/bbolt/command/command_bench.go:653–678  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

651}
652
653func stopProfiling(cmd *cobra.Command) {
654 if cpuprofile != nil {
655 pprof.StopCPUProfile()
656 cpuprofile.Close()
657 cpuprofile = nil
658 }
659
660 if memprofile != nil {
661 err := pprof.Lookup("heap").WriteTo(memprofile, 0)
662 if err != nil {
663 fmt.Fprintf(cmd.ErrOrStderr(), "bench: could not write mem profile")
664 }
665 memprofile.Close()
666 memprofile = nil
667 }
668
669 if blockprofile != nil {
670 err := pprof.Lookup("block").WriteTo(blockprofile, 0)
671 if err != nil {
672 fmt.Fprintf(cmd.ErrOrStderr(), "bench: could not write block profile")
673 }
674 blockprofile.Close()
675 blockprofile = nil
676 runtime.SetBlockProfileRate(0)
677 }
678}
679
680// benchResults represents the performance results of the benchmark and is thread-safe.
681type benchResults struct {

Callers 2

runWritesFunction · 0.85
runReadsFunction · 0.85

Calls 2

WriteToMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected