Browse Source

tools/tmbench: Fix the end time being used for statistics calculation

Previously we were using the time at which all connections closed in statistics, not
the time after {duration} seconds.
pull/1962/head
ValarDragon 6 years ago
parent
commit
75c9303c68
2 changed files with 12 additions and 10 deletions
  1. +1
    -1
      CHANGELOG.md
  2. +11
    -9
      tools/tm-bench/main.go

+ 1
- 1
CHANGELOG.md View File

@ -16,7 +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] Fix method of computing start time
- [tm_bench] Fix method of computing start time, and end time
## 0.22.1 ## 0.22.1


+ 11
- 9
tools/tm-bench/main.go View File

@ -25,13 +25,13 @@ type statistics struct {
} }
func main() { func main() {
var duration, txsRate, connections, txSize int
var durationInt, txsRate, connections, txSize int
var verbose bool var verbose bool
var outputFormat, broadcastTxMethod string var outputFormat, broadcastTxMethod string
flagSet := flag.NewFlagSet("tm-bench", flag.ExitOnError) flagSet := flag.NewFlagSet("tm-bench", flag.ExitOnError)
flagSet.IntVar(&connections, "c", 1, "Connections to keep open per endpoint") flagSet.IntVar(&connections, "c", 1, "Connections to keep open per endpoint")
flagSet.IntVar(&duration, "T", 10, "Exit after the specified amount of time in seconds")
flagSet.IntVar(&durationInt, "T", 10, "Exit after the specified amount of time in seconds")
flagSet.IntVar(&txsRate, "r", 1000, "Txs per second to send in a connection") flagSet.IntVar(&txsRate, "r", 1000, "Txs per second to send in a connection")
flagSet.IntVar(&txSize, "s", 250, "The size of a transaction in bytes.") flagSet.IntVar(&txSize, "s", 250, "The size of a transaction in bytes.")
flagSet.StringVar(&outputFormat, "output-format", "plain", "Output format: plain or json") flagSet.StringVar(&outputFormat, "output-format", "plain", "Output format: plain or json")
@ -73,7 +73,7 @@ Examples:
} }
logger = log.NewTMLoggerWithColorFn(log.NewSyncWriter(os.Stdout), colorFn) logger = log.NewTMLoggerWithColorFn(log.NewSyncWriter(os.Stdout), colorFn)
fmt.Printf("Running %ds test @ %s\n", duration, flagSet.Arg(0))
fmt.Printf("Running %ds test @ %s\n", durationInt, flagSet.Arg(0))
} }
if broadcastTxMethod != "async" && if broadcastTxMethod != "async" &&
@ -105,9 +105,12 @@ Examples:
timeStart := time.Now() timeStart := time.Now()
logger.Info("Time last transacter started", "t", timeStart) logger.Info("Time last transacter started", "t", timeStart)
endTime := time.Duration(duration) * time.Second
duration := time.Duration(durationInt) * time.Second
<-time.After(endTime)
timeEnd := timeStart.Add(duration)
logger.Info("End time for calculation", "t", timeEnd)
<-time.After(duration)
for i, t := range transacters { for i, t := range transacters {
t.Stop() t.Stop()
numCrashes := countCrashes(t.connsBroken) numCrashes := countCrashes(t.connsBroken)
@ -116,15 +119,14 @@ Examples:
} }
} }
timeStop := time.Now()
logger.Info("Time stopped", "t", timeStop)
logger.Debug("Time all transacters stopped", "t", time.Now())
stats, err := calculateStatistics( stats, err := calculateStatistics(
client, client,
initialHeight, initialHeight,
timeStart, timeStart,
timeStop,
duration,
timeEnd,
durationInt,
) )
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)


Loading…
Cancel
Save