Browse Source

tools/tm-bench: Don't count the first block if its empty

pull/1962/head
ValarDragon 6 years ago
parent
commit
50ea68a426
4 changed files with 23 additions and 7 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +5
    -6
      tools/tm-bench/Gopkg.lock
  3. +5
    -0
      tools/tm-bench/Gopkg.toml
  4. +12
    -1
      tools/tm-bench/main.go

+ 1
- 0
CHANGELOG.md View File

@ -16,6 +16,7 @@ BUG FIXES
- NOTE: this is only for URI requests. JSONRPC requests and all responses - NOTE: this is only for URI requests. JSONRPC requests and all responses
will use quoted integers (the proto3 JSON standard). will use quoted integers (the proto3 JSON standard).
- [consensus] Fix halt on shutdown - [consensus] Fix halt on shutdown
- [tm_bench] Ignore the first block if we didn't start sending txs by then
## 0.22.1 ## 0.22.1


+ 5
- 6
tools/tm-bench/Gopkg.lock View File

@ -119,7 +119,7 @@
"prometheus", "prometheus",
"prometheus/promhttp" "prometheus/promhttp"
] ]
revision = "ae27198cdd90bf12cd134ad79d1366a6cf49f632"
revision = "ee1c9d7e23df7f011bdf6f12a5c9e7f0ae10a1fe"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -237,7 +237,7 @@
"types", "types",
"version" "version"
] ]
revision = "9d81a74429e093f3167875e0145ad957874c77d1"
revision = "f5ad8ef8600c33532a16de0879ff6b9745bb394d"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -268,7 +268,7 @@
"netutil", "netutil",
"trace" "trace"
] ]
revision = "292b43bbf7cb8d35ddf40f8d5100ef3837cced3f"
revision = "039a4258aec0ad3c79b905677cceeab13b296a77"
[[projects]] [[projects]]
name = "golang.org/x/text" name = "golang.org/x/text"
@ -292,10 +292,9 @@
version = "v0.3.0" version = "v0.3.0"
[[projects]] [[projects]]
branch = "master"
name = "google.golang.org/genproto" name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"] packages = ["googleapis/rpc/status"]
revision = "e92b116572682a5b432ddd840aeaba2a559eeff1"
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
[[projects]] [[projects]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
@ -330,6 +329,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "bc54a74ffdfc09872726fcf5c72b5df882269dc1cd949ac3fbeac9a554fc25c6"
inputs-digest = "5c21a60b80ac7d60f7be693de13f9fadb62226b502431bdb38fb9794a98c5b02"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

+ 5
- 0
tools/tm-bench/Gopkg.toml View File

@ -45,6 +45,11 @@
name = "github.com/tendermint/tendermint" name = "github.com/tendermint/tendermint"
branch = "develop" branch = "develop"
# this got updated and broke, so locked to an old working commit ...
[[override]]
name = "google.golang.org/genproto"
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
[prune] [prune]
go-tests = true go-tests = true
unused-packages = true unused-packages = true

+ 12
- 1
tools/tm-bench/main.go View File

@ -189,6 +189,16 @@ func calculateStatistics(
offset = len(blockMetas) offset = len(blockMetas)
} }
// Ignore the first block created if there were no txs in it, since we likely didn't begin
// sending txs by then. The last index is the block that was already present when we started
// this process
if blockMetas[len(blockMetas)-2].Header.NumTxs == 0 {
if timeStart.Before(blockMetas[len(blockMetas)-2].Header.Time) {
timeStart = blockMetas[len(blockMetas)-2].Header.Time
}
blockMetas = blockMetas[:len(blockMetas)-2]
}
var ( var (
numBlocksPerSec = make(map[int64]int64) numBlocksPerSec = make(map[int64]int64)
numTxsPerSec = make(map[int64]int64) numTxsPerSec = make(map[int64]int64)
@ -201,7 +211,7 @@ func calculateStatistics(
} }
// iterates from max height to min height // iterates from max height to min height
for _, blockMeta := range blockMetas {
for i, blockMeta := range blockMetas {
// check if block was created after timeStart // check if block was created after timeStart
if blockMeta.Header.Time.Before(timeStart) { if blockMeta.Header.Time.Before(timeStart) {
break break
@ -218,6 +228,7 @@ func calculateStatistics(
// increase number of txs for that second // increase number of txs for that second
numTxsPerSec[sec] += blockMeta.Header.NumTxs numTxsPerSec[sec] += blockMeta.Header.NumTxs
logger.Debug(fmt.Sprintf("%d txs in block %d, height %d", blockMeta.Header.NumTxs, i, blockMeta.Header.Height))
} }
for _, n := range numBlocksPerSec { for _, n := range numBlocksPerSec {


Loading…
Cancel
Save