statistic update

pull/232/head
Gordon 3 years ago
parent 967a4c7748
commit 4f165f3b27

@ -9,7 +9,7 @@ type Statistics struct {
AllCount *uint64 AllCount *uint64
ModuleName string ModuleName string
PrintArgs string PrintArgs string
SleepTime int SleepTime uint64
} }
func (s *Statistics) output() { func (s *Statistics) output() {
@ -29,12 +29,12 @@ func (s *Statistics) output() {
intervalCount = *s.AllCount - sum intervalCount = *s.AllCount - sum
} }
timeIntervalNum++ timeIntervalNum++
log.NewWarn("", " system stat ", s.ModuleName, s.PrintArgs, intervalCount, "total:", *s.AllCount, "intervalNum", timeIntervalNum) log.NewWarn("", " system stat ", s.ModuleName, s.PrintArgs, intervalCount, "total:", *s.AllCount, "intervalNum", timeIntervalNum, "avg", (*s.AllCount)/(timeIntervalNum)/s.SleepTime)
} }
} }
func NewStatistics(allCount *uint64, moduleName, printArgs string, sleepTime int) *Statistics { func NewStatistics(allCount *uint64, moduleName, printArgs string, sleepTime int) *Statistics {
p := &Statistics{AllCount: allCount, ModuleName: moduleName, SleepTime: sleepTime, PrintArgs: printArgs} p := &Statistics{AllCount: allCount, ModuleName: moduleName, SleepTime: uint64(sleepTime), PrintArgs: printArgs}
go p.output() go p.output()
return p return p
} }

Loading…
Cancel
Save