add separated runs by UUID

This commit is contained in:
William Banfield
2022-09-02 17:24:20 -04:00
parent 8655080a0f
commit 80c8b86553
10 changed files with 183 additions and 78 deletions
+5
View File
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"github.com/google/uuid"
"github.com/informalsystems/tm-load-test/pkg/loadtest"
"github.com/tendermint/tendermint/test/loadtime/payload"
)
@@ -20,6 +21,7 @@ type ClientFactory struct{}
// TxGenerator holds the set of information that will be used to generate
// each transaction.
type TxGenerator struct {
id []byte
conns uint64
rate uint64
size uint64
@@ -49,7 +51,9 @@ func (f *ClientFactory) ValidateConfig(cfg loadtest.Config) error {
}
func (f *ClientFactory) NewClient(cfg loadtest.Config) (loadtest.Client, error) {
u := [16]byte(uuid.New())
return &TxGenerator{
id: u[:],
conns: uint64(cfg.Connections),
rate: uint64(cfg.Rate),
size: uint64(cfg.Size),
@@ -61,5 +65,6 @@ func (c *TxGenerator) GenerateTx() ([]byte, error) {
Connections: c.conns,
Rate: c.rate,
Size: c.size,
Id: c.id,
})
}
+33 -17
View File
@@ -8,7 +8,6 @@ import (
"os"
"strconv"
"strings"
"time"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/test/loadtime/report"
@@ -48,7 +47,7 @@ func main() {
}
s := store.NewBlockStore(db)
defer s.Close()
r, err := report.GenerateFromBlockStore(s)
rs, err := report.GenerateFromBlockStore(s)
if err != nil {
panic(err)
}
@@ -58,30 +57,47 @@ func main() {
panic(err)
}
w := csv.NewWriter(cf)
err = w.WriteAll(toRecords(r.All))
err = w.WriteAll(toCSVRecords(rs.List()))
if err != nil {
panic(err)
}
return
}
for _, r := range rs.List() {
fmt.Printf(""+
"Experiment ID: %s\n\n"+
"\tConnections: %d\n"+
"\tRate: %d\n"+
"\tSize: %d\n\n"+
"\tTotal Valid Tx: %d\n"+
"\tTotal Negative Latencies: %d\n"+
"\tMinimum Latency: %s\n"+
"\tMaximum Latency: %s\n"+
"\tAverage Latency: %s\n"+
"\tStandard Deviation: %s\n\n", r.Id, r.Connections, r.Rate, r.Size, len(r.All), r.NegativeCount, r.Min, r.Max, r.Avg, r.StdDev)
fmt.Printf(""+
"Total Valid Tx: %d\n"+
"Total Invalid Tx: %d\n"+
"Total Negative Latencies: %d\n"+
"Minimum Latency: %s\n"+
"Maximum Latency: %s\n"+
"Average Latency: %s\n"+
"Standard Deviation: %s\n", len(r.All), r.ErrorCount, r.NegativeCount, r.Min, r.Max, r.Avg, r.StdDev)
}
fmt.Printf("Total Invalid Tx: %d\n", rs.ErrorCount())
}
func toRecords(l []time.Duration) [][]string {
res := make([][]string, len(l)+1)
func toCSVRecords(rs []report.Report) [][]string {
total := 0
for _, v := range rs {
total += len(v.All)
}
res := make([][]string, total+1)
res[0] = make([]string, 1)
res[0][0] = "duration_ns"
for i, v := range l {
res[1+i] = []string{strconv.FormatInt(int64(v), 10)}
res[0] = []string{"experiment_id", "duration_ns", "connections", "rate", "size"}
offset := 1
for _, r := range rs {
idStr := r.Id.String()
connStr := strconv.FormatInt(int64(r.Connections), 10)
rateStr := strconv.FormatInt(int64(r.Rate), 10)
sizeStr := strconv.FormatInt(int64(r.Size), 10)
for i, v := range r.All {
res[offset+i] = []string{idStr, strconv.FormatInt(int64(v), 10), connStr, rateStr, sizeStr}
}
offset += len(r.All)
}
return res
}