79fbb4085d
- This fixes a bug where the torrent client didn't unlock the bolt db See: anacrolix/torrent/issues/158
18 lignes
303 o
Go
18 lignes
303 o
Go
package perf
|
|
|
|
import (
|
|
"runtime"
|
|
)
|
|
|
|
func ScopeTimer() func() {
|
|
t := NewTimer(Name(getCallerName()), Log)
|
|
return func() { t.Mark("returned") }
|
|
}
|
|
|
|
func getCallerName() string {
|
|
var pc [1]uintptr
|
|
runtime.Callers(3, pc[:])
|
|
fs := runtime.CallersFrames(pc[:])
|
|
f, _ := fs.Next()
|
|
return f.Func.Name()
|
|
}
|