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

https://github.com/orisano/nopieprofile


https://github.com/orisano/nopieprofile

Last synced: over 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# nopieprofile
nopieprofile is a Go package that provides utilities for converting CPU profiles generated by Go's pprof tool from runtime addresses to static addresses.

## Motivation
When Go binaries are built with Position-Independent Executables (PIE) enabled, the addresses of the functions and variables in the binary are determined at runtime. This can make it difficult to analyze CPU profiles generated by the pprof tool, because the profile samples will contain runtime addresses that are different each time the program runs.

nopieprofile provides a way to convert such profiles to use static addresses instead of runtime addresses, making them more amenable to analysis and easier to compare across multiple runs.

## Example
```go
package nopieprofile_test

import (
"log"
"os"
"testing"

"github.com/orisano/nopieprofile"
)

func TestMain(m *testing.M) {
code := m.Run()
if err := nopieprofile.RewriteTestProfile(); err != nil {
log.Printf("warn: failed to rewrite test profile: %v", err)
}
os.Exit(code)
}
```

shorthand
```go
package nopieprofile_test

import (
"testing"

"github.com/orisano/nopieprofile/nopieprofiletest"
)

func TestMain(m *testing.M) { nopieprofiletest.Main(m) }
```

## License
MIT