We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f2a5016 commit ac4374eCopy full SHA for ac4374e
stack_test.go
@@ -6,6 +6,7 @@ import (
6
"path"
7
"path/filepath"
8
"runtime"
9
+ "strings"
10
"testing"
11
12
"github.com/go-stack/stack"
@@ -259,6 +260,17 @@ func BenchmarkRuntimeCaller(b *testing.B) {
259
260
}
261
262
263
+func BenchmarkRuntimeCallerAndFmt(b *testing.B) {
264
+ for i := 0; i < b.N; i++ {
265
+ _, file, line, _ := runtime.Caller(0)
266
+ const sep = "/"
267
+ if i := strings.LastIndex(file, sep); i != -1 {
268
+ file = file[i+len(sep):]
269
+ }
270
+ fmt.Fprint(ioutil.Discard, file, ":", line)
271
272
+}
273
+
274
func BenchmarkFuncForPC(b *testing.B) {
275
pc, _, _, _ := runtime.Caller(0)
276
pc--
0 commit comments