diff --git a/tools/tm-bench/statistics.go b/tools/tm-bench/statistics.go index c1110a83..ce4bd0f0 100644 --- a/tools/tm-bench/statistics.go +++ b/tools/tm-bench/statistics.go @@ -67,9 +67,8 @@ func calculateStatistics( numBlocksPerSec[sec]++ // increase number of txs for that second - // TODO: add tracking for tx/sec - numTxsPerSec[sec] += 1 - logger.Debug(fmt.Sprintf("%d txs at block height %d", 1, blockMeta.Header.Height)) + numTxsPerSec[sec] += blockMeta.NumTxs + logger.Debug(fmt.Sprintf("%d txs at block height %d", blockMeta.NumTxs, blockMeta.Header.Height)) } for i := int64(0); i < int64(duration); i++ { diff --git a/types/block_meta.go b/types/block_meta.go index 8297446a..02728be4 100644 --- a/types/block_meta.go +++ b/types/block_meta.go @@ -2,8 +2,9 @@ package types // BlockMeta contains meta information about a block - namely, it's ID and Header. type BlockMeta struct { - BlockID BlockID `json:"block_id"` // the block hash and partsethash - Header Header `json:"header"` // The block's Header + BlockID BlockID `json:"block_id"` // the block hash and partsethash + Header Header `json:"header"` // The block's Header + NumTxs int64 `json:"number_txs"` // } // NewBlockMeta returns a new BlockMeta from the block and its blockParts. @@ -11,6 +12,7 @@ func NewBlockMeta(block *Block, blockParts *PartSet) *BlockMeta { return &BlockMeta{ BlockID: BlockID{block.Hash(), blockParts.Header()}, Header: block.Header, + NumTxs: int64(len(block.Data.Txs)), } }