diff --git a/modules/hero/hero_test.go b/modules/hero/hero_test.go index e93dca1ea..d5a4ab5d5 100644 --- a/modules/hero/hero_test.go +++ b/modules/hero/hero_test.go @@ -18,7 +18,9 @@ import ( "go_dreamfactory/sys/configure" "go_dreamfactory/sys/db" "go_dreamfactory/utils" + "os" "reflect" + "runtime/trace" "strings" "testing" "time" @@ -70,6 +72,20 @@ func GetMonthStartEnd() (int64, int64) { return _d1, _d2 } func Test_Main(t *testing.T) { + //创建trace文件 + f, err := os.Create("trace.out") + if err != nil { + panic(err) + } + + defer f.Close() + + //启动trace goroutine + err = trace.Start(f) + if err != nil { + panic(err) + } + defer trace.Stop() var star1, star2, star3 int32 var rst int32