github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/system/trace/tx_log.go (about) 1 package trace 2 3 type txLog struct { 4 startTime int64 5 AllCost int64 6 Record map[string]*operateInfo // not support pall tx 7 } 8 9 func newTxLog() *txLog { 10 tmp := &txLog{ 11 startTime: getNowTimeMs(), 12 Record: make(map[string]*operateInfo), 13 } 14 15 return tmp 16 } 17 18 func (s *txLog) StartTxLog(oper string) { 19 if _, ok := s.Record[oper]; !ok { 20 s.Record[oper] = newOperateInfo() 21 } 22 s.Record[oper].StartOper() 23 } 24 25 func (s *txLog) StopTxLog(oper string) { 26 if _, ok := s.Record[oper]; !ok { 27 return 28 } 29 s.Record[oper].StopOper() 30 }