Browse Source

wip fixes

pull/1943/head
Ethan Buchman 7 years ago
committed by ValarDragon
parent
commit
e79b642d8d
2 changed files with 20 additions and 4 deletions
  1. +20
    -1
      tm-bench/main.go
  2. +0
    -3
      tm-bench/transacter.go

+ 20
- 1
tm-bench/main.go View File

@ -132,6 +132,22 @@ func calculateStatistics(client tmrpc.Client, minHeight int64, timeStart, timeSt
os.Exit(1)
}
maxHeight := info.LastHeight
diff := maxHeight - minHeight
blockMetas := info.BlockMetas
offset := len(blockMetas)
for len(blockMetas) < int(diff) {
// get blocks between minHeight and last height
info, err := client.BlockchainInfo(minHeight+int64(offset), 0)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
blockMetas = append(blockMetas, info.BlockMetas...)
offset = len(blockMetas)
}
numBlocksPerSec := make(map[int64]int64)
numTxsPerSec := make(map[int64]int64)
// because during some seconds blocks won't be created...
@ -140,7 +156,7 @@ func calculateStatistics(client tmrpc.Client, minHeight int64, timeStart, timeSt
numTxsPerSec[i] = 0
}
for _, blockMeta := range info.BlockMetas {
for _, blockMeta := range blockMetas {
// check if block was created after timeStart
if blockMeta.Header.Time.Before(timeStart) {
continue
@ -174,6 +190,9 @@ func calculateStatistics(client tmrpc.Client, minHeight int64, timeStart, timeSt
stats.TxsThroughput.Update(n)
}
fmt.Println("blocks", numBlocksPerSec)
fmt.Println("txs", numTxsPerSec)
return stats
}


+ 0
- 3
tm-bench/transacter.go View File

@ -176,9 +176,6 @@ func (t *transacter) sendLoop(connIndex int) {
}
timeToSend := time.Now().Sub(startTime)
if timeToSend < 1*time.Second {
time.Sleep(time.Second - timeToSend)
}
logger.Info(fmt.Sprintf("sent %d transactions", t.Rate), "took", timeToSend)
case <-pingsTicker.C:
// go-rpc server closes the connection in the absence of pings


Loading…
Cancel
Save