mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-10 04:47:53 +00:00
report QPS after last query
More generally, report QPS not at 0 queries, which is boring, but every 100 queries *and* after the last query if the last query wasn't at a multiple of 100 queries. Makes the output slightly more useful, I think.
This commit is contained in:
parent
7271fbf396
commit
48b97d6ad4
1 changed files with 14 additions and 6 deletions
|
|
@ -133,6 +133,17 @@ func (cfg *RandomQueryConfig) Run() (err error) {
|
|||
loops := 0
|
||||
t0 := time.Now()
|
||||
|
||||
report := func() {
|
||||
dur := time.Since(t0)
|
||||
if dur > 0 {
|
||||
qps := 1e9 * float64(totalQ) / float64(dur)
|
||||
AlwaysPrintf("totalQueries run: %v elapsed: %v qps: %0.02f", totalQ, dur, qps)
|
||||
} else {
|
||||
AlwaysPrintf("totalQueries run: %v elapsed: %v qps: N/A", totalQ, dur)
|
||||
}
|
||||
}
|
||||
defer report()
|
||||
|
||||
NewSetup:
|
||||
err = cfg.Setup(cli)
|
||||
if err != nil {
|
||||
|
|
@ -162,12 +173,8 @@ NewSetup:
|
|||
goto NewSetup
|
||||
}
|
||||
}
|
||||
if totalQ%100 == 0 {
|
||||
dur := time.Since(t0)
|
||||
if dur > 0 {
|
||||
qps := 1e9 * float64(totalQ) / float64(dur)
|
||||
AlwaysPrintf("totalQueries run: %v elapsed: %v qps: %0.02f", totalQ, dur, qps)
|
||||
}
|
||||
if totalQ > 0 && totalQ%100 == 0 {
|
||||
report()
|
||||
}
|
||||
|
||||
index := indexes[rand.Intn(len(indexes))]
|
||||
|
|
@ -190,6 +197,7 @@ NewSetup:
|
|||
}
|
||||
totalQ++
|
||||
loops++
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue