Simple profiling for Go
Switch branches/tags
Clone or download
Latest commit 057bc52 Aug 9, 2018


Simple profiling support package for Go

Build Status GoDoc


go get


Enabling profiling in your application is as simple as one line at the top of your main function

import ""

func main() {
    defer profile.Start().Stop()


What to profile is controlled by config value passed to profile.Start. By default CPU profiling is enabled.

import ""

func main() {
    // p.Stop() must be called before the program exits to
    // ensure profiling information is written to disk.
    p := profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)

Several convenience package level values are provided for cpu, memory, and block (contention) profiling.

For more complex options, consult the documentation.


We welcome pull requests, bug fixes and issue reports.

Before proposing a change, please discuss it first by raising an issue.