Commit 1e847059 authored by Brian Tiger Chow's avatar Brian Tiger Chow

style(cmd/ipfs/pprof) move defer close to initialization

parent 79866d33
......@@ -5,3 +5,11 @@ build:
install: build
go install
# cpu profiling: `go tool pprof ipfs cpu.prof`
# mem profiling: `go tool pprof ipfs ipfs.mprof`
clean:
rm -f cpu.prof
rm -f ipfs.mprof
rm -f ipfs
......@@ -99,12 +99,14 @@ func main() {
// if debugging, setup profiling.
if u.Debug {
ofi, err := os.Create("cpu.prof")
defer ofi.Close()
if err != nil {
fmt.Println(err)
return
}
pprof.StartCPUProfile(ofi)
defer ofi.Close()
defer pprof.StopCPUProfile()
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment