An open API service indexing awesome lists of open source software.

https://github.com/jcocozza/goprof

wrapper around golang's pprof
https://github.com/jcocozza/goprof

Last synced: 10 months ago
JSON representation

wrapper around golang's pprof

Awesome Lists containing this project

README

          

# goprof

goprof is a convenience wrapper around go's pprof library.
If you need more control when profiling, don't use this.

You should only call `Start()` or `Run()` once in your code.
Calling more then once will return an error.
Calling `Stop()` before `Start()` or `Run()` will also produce an error.

There are three main ways to use this package:

1. Targets to a specific bit of code

```go
goprof.Run("", func() {
//
})
```

2. Target a chunk of code. Anywhere in your code call the following:

```go
if err := goprof.Start(""); err != nil {
// handle error
}

//

if err := goprof.End(); err != nil {
// handle error
}
```

3. Profile all your code. At the beginning of your main method, just call:

```go
goprof.Start("")
defer goprof.End()
```