mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 04:55:18 +00:00
* add separated runs by UUID (#9367)
This _should_ be the last piece needed for this tool.
This allows the tool to generate reports on multiple experimental runs that may have been performed against the same chain.
The `load` tool has been updated to generate a `UUID` on startup to uniquely identify each experimental run. The `report` tool separates all of the results it reads by `UUID` and performs separate calculations for each discovered experiment.
Sample output is as follows
```
Experiment ID: 6bd7d1e8-d82c-4dbe-a1b3-40ab99e4fa30
Connections: 1
Rate: 1000
Size: 1024
Total Valid Tx: 9000
Total Negative Latencies: 0
Minimum Latency: 86.632837ms
Maximum Latency: 1.151089602s
Average Latency: 813.759361ms
Standard Deviation: 225.189977ms
Experiment ID: 453960af-6295-4282-aed6-367fc17c0de0
Connections: 1
Rate: 1000
Size: 1024
Total Valid Tx: 9000
Total Negative Latencies: 0
Minimum Latency: 79.312992ms
Maximum Latency: 1.162446243s
Average Latency: 422.755139ms
Standard Deviation: 241.832475ms
Total Invalid Tx: 0
```
closes: #9352
#### PR checklist
- [ ] Tests written/updated, or no tests needed
- [ ] `CHANGELOG_PENDING.md` updated, or no changelog entry needed
- [ ] Updated relevant documentation (`docs/`) and code comments, or no
documentation updates needed
(cherry picked from commit 1067ba1571)
# Conflicts:
# go.mod
* fix merge conflict
* fix lint
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
Co-authored-by: William Banfield <wbanfield@gmail.com>
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package payload_test
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/tendermint/tendermint/test/loadtime/payload"
|
|
)
|
|
|
|
const payloadSizeTarget = 1024 // 1kb
|
|
|
|
func TestSize(t *testing.T) {
|
|
s, err := payload.MaxUnpaddedSize()
|
|
if err != nil {
|
|
t.Fatalf("calculating max unpadded size %s", err)
|
|
}
|
|
if s > payloadSizeTarget {
|
|
t.Fatalf("unpadded payload size %d exceeds target %d", s, payloadSizeTarget)
|
|
}
|
|
}
|
|
|
|
func TestRoundTrip(t *testing.T) {
|
|
const (
|
|
testConns = 512
|
|
testRate = 4
|
|
)
|
|
testID := [16]byte(uuid.New())
|
|
b, err := payload.NewBytes(&payload.Payload{
|
|
Size: payloadSizeTarget,
|
|
Connections: testConns,
|
|
Rate: testRate,
|
|
Id: testID[:],
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("generating payload %s", err)
|
|
}
|
|
if len(b) < payloadSizeTarget {
|
|
t.Fatalf("payload size in bytes %d less than expected %d", len(b), payloadSizeTarget)
|
|
}
|
|
p, err := payload.FromBytes(b)
|
|
if err != nil {
|
|
t.Fatalf("reading payload %s", err)
|
|
}
|
|
if p.Size != payloadSizeTarget {
|
|
t.Fatalf("payload size value %d does not match expected %d", p.Size, payloadSizeTarget)
|
|
}
|
|
if p.Connections != testConns {
|
|
t.Fatalf("payload connections value %d does not match expected %d", p.Connections, testConns)
|
|
}
|
|
if p.Rate != testRate {
|
|
t.Fatalf("payload rate value %d does not match expected %d", p.Rate, testRate)
|
|
}
|
|
if !bytes.Equal(p.Id, testID[:]) {
|
|
t.Fatalf("payload ID value %d does not match expected %d", p.Id, testID)
|
|
}
|
|
}
|