Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Oct 21, 2020
1 parent deb669b commit 05b30b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 0 additions & 6 deletions load/worker_ticker.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package load

import (
"fmt"
"time"
)

Expand Down Expand Up @@ -69,12 +68,8 @@ func (c *StepWorkerTicker) Run() {
c.C <- TickValue{Delta: int(c.Start)}

go func() {
fmt.Println("step ticker start")
for range ticker.C {
fmt.Println("worker ticker", time.Since(begin))
if c.LoadDuration > 0 && time.Since(begin) > c.LoadDuration {
fmt.Println("duration stop reached", wc, time.Since(begin))

if c.Stop > 0 {
c.C <- TickValue{Delta: int(c.Stop - uint(wc))}
}
Expand All @@ -83,7 +78,6 @@ func (c *StepWorkerTicker) Run() {
return
} else if (c.Stop > 0 && stepUp && wc >= int(c.Stop)) ||
(!stepUp && wc <= int(c.Stop)) || wc <= 0 {
fmt.Println("stop reached", wc, time.Since(begin))
done <- true
return
} else {
Expand Down
14 changes: 10 additions & 4 deletions runner/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ func (b *Requester) runWorkers(wt load.WorkerTicker, p load.Pacer) error {

// worker control ticker goroutine
go func() {
fmt.Println("worker ticker goroutine")
wt.Run()
}()

Expand All @@ -350,7 +349,10 @@ func (b *Requester) runWorkers(wt load.WorkerTicker, p load.Pacer) error {
n := 0
wc := 0
for tv := range wct {
fmt.Println(tv)
if b.config.hasLog {
b.config.log.Debugw("Worker ticker.", "delta", tv.Delta)
}

if tv.Delta > 0 {
for i := 0; i < tv.Delta; i++ {
wID := "g" + strconv.Itoa(wc) + "c" + strconv.Itoa(n)
Expand Down Expand Up @@ -431,7 +433,9 @@ func (b *Requester) runWorkers(wt load.WorkerTicker, p load.Pacer) error {
wait, stop := p.Pace(time.Since(began), counter.Get())

if stop {
fmt.Println("stop")
if b.config.hasLog {
b.config.log.Debugw("Received stop from pacer.")
}
done <- struct{}{}
return
}
Expand All @@ -444,7 +448,9 @@ func (b *Requester) runWorkers(wt load.WorkerTicker, p load.Pacer) error {
case ticks <- TickValue{instant: time.Now(), reqNumber: counter.Inc() - 1}:
continue
case <-b.stopCh:
fmt.Println("stop. count:", counter.Get())
if b.config.hasLog {
b.config.log.Debugw("Signal received from stop channel.", "count", counter.Get())
}
done <- struct{}{}
return
}
Expand Down
1 change: 0 additions & 1 deletion runner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func (w *Worker) Stop() {
}

func (w *Worker) makeRequest(tv TickValue) error {
// fmt.Println("wid:", w.workerID, tv.instant.String(), tv.reqNumber)
reqNum := int64(tv.reqNumber)

ctd := newCallTemplateData(w.mtd, w.config.funcs, w.workerID, reqNum)
Expand Down

0 comments on commit 05b30b9

Please sign in to comment.