Working out transaction rate

Strange… can’t see why I’m battling with this…

I have:

vStart := time.Now()
// Do allot of work, through loops
vEnd := time.Now()
vTime := int(vEnd.Sub(vStart))
// todo_count as a int contains number of records/transactions processed during the elapsed time
Now trying to show ups
// this of course fails... as vTime is a crazy number... and not as expected a x amounts of second.
fmt.Println(todo_count/vTime)

G

solved.

vStart := time.Now()
// Do work
vEnd := time.Now()

vElapse := vEnd.Sub(vStart)
fmt.Println(Start                         : , vStart)
fmt.Println(End                           : , vEnd)
fmt.Println(Duration (Seconds)            : , vElapse.Seconds())
fmt.Println(Records Processed             : , todo_count)
fmt.Println(Rate Txn/Second               : , float64(todo_count)/vElapse.Seconds())
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.