wip fixes
This commit is contained in:
parent
47256cfda2
commit
e79b642d8d
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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…
Reference in New Issue