utils

package
v0.39.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const EnvP2PBench = "P2P_BENCH_TEST"

Variables

This section is empty.

Functions

func GetFreePorts

func GetFreePorts(t *testing.T, n int) []int

GetFreePorts returns n free ports

func GuardP2PBenchTest

func GuardP2PBenchTest(t *testing.T)

func LogBytesThroughputStats added in v0.39.1

func LogBytesThroughputStats(t *testing.T, title string, bytes uint64, duration time.Duration) float64

func LogDurationStats

func LogDurationStats(t *testing.T, title string, durations []time.Duration) map[string]any

func LogPerformanceStatsBroadcast added in v0.39.1

func LogPerformanceStatsBroadcast(
	t *testing.T,
	start time.Time,
	sentMessages int,
	receiveSuccess []atomic.Uint64,
	receiveBytes []atomic.Uint64,
	receiveLatencies [][]time.Duration,
	timeTaken []time.Duration,
) map[string]any

func LogPerformanceStatsSend added in v0.39.1

func LogPerformanceStatsSend(
	t *testing.T,
	start time.Time,
	sendSuccess, sendFailed, receivedSuccess uint64,
	sendBytesTotal, receiveBytesTotal uint64,
	receiveLatencies []time.Duration,
) map[string]any

func PrintMatrixOnly added in v0.39.1

func PrintMatrixOnly() bool

func WaitForProcessing added in v0.39.1

func WaitForProcessing(
	t *testing.T,
	ctx context.Context,
	name string,
	expected, actual *atomic.Uint64,
	maxIdleWait time.Duration,
) (completed bool)

Types

type PerfRecord added in v0.39.1

type PerfRecord struct {
	Payload []byte

	SentAt      time.Time
	ReceivedAt  time.Time
	ProcessedAt time.Time
}

PerfRecord dummy payload just to measure various performance metrics in benchmarks.

func (*PerfRecord) AsEcho added in v0.39.1

func (r *PerfRecord) AsEcho() *types.RequestEcho

message: [sent_at | payload]

func (*PerfRecord) FromEcho added in v0.39.1

func (r *PerfRecord) FromEcho(echo *types.RequestEcho) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL