From 0989c78d4b9c4ac490447f763722ce21794d58eb Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 8 Nov 2020 12:33:24 -0800 Subject: [PATCH] Fix the profiling... --- cmd/root.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index de7f2f1..fe92e6e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -93,21 +93,21 @@ func rootCmdRun(*cobra.Command, []string) { switch profiler { case "cpu": - profile.Start(profile.CPUProfile) + defer profile.Start(profile.CPUProfile).Stop() case "mem": - profile.Start(profile.MemProfile) + defer profile.Start(profile.MemProfile).Stop() case "alloc": - profile.Start(profile.MemProfileAllocs()) + defer profile.Start(profile.MemProfile, profile.MemProfileAllocs()).Stop() case "heap": - profile.Start(profile.MemProfileHeap()) + defer profile.Start(profile.MemProfile, profile.MemProfileHeap()).Stop() case "routines": - profile.Start(profile.GoroutineProfile) + defer profile.Start(profile.GoroutineProfile).Stop() case "mutex": - profile.Start(profile.MutexProfile) + defer profile.Start(profile.MutexProfile).Stop() case "threads": - profile.Start(profile.ThreadcreationProfile) + defer profile.Start(profile.ThreadcreationProfile).Stop() case "block": - profile.Start(profile.BlockProfile) + defer profile.Start(profile.BlockProfile).Stop() } // Only attempt configuration file relocation if a custom location has not