1
0
Fork 0

Collect task wait statistics

This commit is contained in:
Gregory Eremin 2015-10-24 18:08:12 +03:00
parent bfa1575d79
commit 1550495bf9
1 changed files with 3 additions and 0 deletions

View File

@ -126,8 +126,11 @@ func (s *Satan) runWorker() {
defer log.Printf("Worker #%d has stopped", i)
for {
start := time.Now()
select {
case t := <-s.queue:
dur := time.Now().UnixNano() - start.UnixNano()
s.Statistics.Add("TaskWait", time.Duration(dur))
s.processTask(t)
case <-s.shutdownWorkers:
return