Skip to content

Commit 80a511f

Browse files
committed
debugui: replace runtime.Caller with Callers for performance
1 parent baa33a1 commit 80a511f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

id.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import (
1010

1111
// caller returns a program counter of the caller.
1212
func caller() uintptr {
13-
pc, _, _, ok := runtime.Caller(2)
14-
if !ok {
13+
var pcs [1]uintptr
14+
n := runtime.Callers(3, pcs[:])
15+
if n == 0 {
1516
return 0
1617
}
17-
return pc
18+
return pcs[0]
1819
}
1920

2021
// Loop creates a loop to iterate by the given count.

0 commit comments

Comments
 (0)