Created
October 27, 2020 14:58
-
-
Save 0xc0d/fdfac34dcbe82c51a1e387045ae8b0fc to your computer and use it in GitHub Desktop.
Different profiles in pkg/profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CPUProfile enables cpu profiling. Note: Default is CPU | |
defer profile.Start(profile.CPUProfile).Stop() | |
// GoroutineProfile enables goroutine profiling. | |
// It returns all Goroutines alive when defer occurs. | |
defer profile.Start(profile.GoroutineProfile).Stop() | |
// BlockProfile enables block (contention) profiling. | |
defer profile.Start(profile.BlockProfile).Stop() | |
// ThreadcreationProfile enables thread creation profiling. | |
defer profile.Start(profile.ThreadcreationProfile).Stop() | |
// MemProfileHeap changes which type of memory profiling to | |
// profile the heap. | |
defer profile.Start(profile.MemProfileHeap).Stop() | |
// MemProfileAllocs changes which type of memory to profile | |
// allocations. | |
defer profile.Start(profile.MemProfileAllocs).Stop() | |
// MutexProfile enables mutex profiling. | |
defer profile.Start(profile.MutexProfile).Stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment