新增性能分析器

This commit is contained in:
duanhf2012
2020-04-02 15:25:25 +08:00
parent 269a999b58
commit 9e128759f6
9 changed files with 262 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/duanhf2012/origin/log"
"github.com/duanhf2012/origin/util/timer"
"reflect"
"runtime"
"time"
)
@@ -170,7 +171,8 @@ func (slf *Module) AfterFunc(d time.Duration, cb func()) *timer.Timer {
slf.mapActiveTimer =map[*timer.Timer]interface{}{}
}
tm := slf.dispatcher.AfterFuncEx(d,func(t *timer.Timer){
funName := runtime.FuncForPC(reflect.ValueOf(cb).Pointer()).Name()
tm := slf.dispatcher.AfterFuncEx(funName,d,func(t *timer.Timer){
cb()
delete(slf.mapActiveTimer,t)
})