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
- Host: GitHub
- URL: https://github.com/jcocozza/goprof
- Owner: jcocozza
- Created: 2025-07-31T21:29:52.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-01T01:27:02.000Z (11 months ago)
- Last Synced: 2025-08-01T03:26:33.503Z (11 months ago)
- Language: Go
- Size: 1000 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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()
```