https://github.com/orisano/nopieprofile
https://github.com/orisano/nopieprofile
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/orisano/nopieprofile
- Owner: orisano
- License: mit
- Created: 2023-03-26T15:16:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-14T08:46:04.000Z (about 3 years ago)
- Last Synced: 2025-03-25T05:34:30.806Z (over 1 year ago)
- Language: Go
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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