diff options
| author | Felix Geisendörfer <felix.geisendoerfer@datadoghq.com> | 2023-03-13 09:56:45 +0100 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2023-03-30 19:18:18 +0000 |
| commit | 25f9af666194f81741aed8ea422661bd58149d30 (patch) | |
| tree | 78c547eb1785862bd034e216d1c6f080651f115a /src/runtime/export_test.go | |
| parent | 3dd221a94d044cb4371ec20266817a703b2fe683 (diff) | |
| download | go-25f9af666194f81741aed8ea422661bd58149d30.tar.xz | |
runtime: add a benchmark of FPCallers
This allows comparing frame pointer unwinding against the default
unwinder as shown below.
goos: linux
goarch: amd64
pkg: runtime
cpu: Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz
│ callers.txt │
│ sec/op │
Callers/cached-32 1.254µ ± 0%
FPCallers/cached-32 24.99n ± 0%
For #16638
Change-Id: I4dd05f82254726152ef4a5d5beceab33641e9d2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/475795
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 367362b672..498c63f5b6 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -1727,3 +1727,9 @@ func FrameStartLine(f *Frame) int { func PersistentAlloc(n uintptr) unsafe.Pointer { return persistentalloc(n, 0, &memstats.other_sys) } + +// FPCallers works like Callers and uses frame pointer unwinding to populate +// pcBuf with the return addresses of the physical frames on the stack. +func FPCallers(skip int, pcBuf []uintptr) int { + return fpTracebackPCs(unsafe.Pointer(getcallerfp()), skip, pcBuf) +} |
