counter.go:
added execution time influxdb.go: write counters to influxdb
This commit is contained in:
parent
236808ffe9
commit
98226a042a
4 changed files with 88 additions and 4 deletions
16
counter.go
16
counter.go
|
@ -3,6 +3,7 @@ package main
|
|||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Counter struct {
|
||||
|
@ -12,6 +13,7 @@ type Counter struct {
|
|||
rem int
|
||||
err int
|
||||
dup int
|
||||
time time.Duration
|
||||
wg []int
|
||||
}
|
||||
|
||||
|
@ -22,6 +24,7 @@ func NewCounter() *Counter {
|
|||
err: 0,
|
||||
rem: 0,
|
||||
dup: 0,
|
||||
time: 0,
|
||||
wg: make([]int, opts.Concurrent),
|
||||
}
|
||||
}
|
||||
|
@ -109,3 +112,16 @@ func (c *Counter) GetWG(id int) (ret int) {
|
|||
ret = c.wg[id]
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Counter) GetTime() (ret float64) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ret = c.time.Seconds()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Counter) SetTime(t time.Duration) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.time = t
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue