test

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package test contains helpers for setting up test utilties.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBenchMessage

func NewBenchMessage(index int32, dataBlob []byte) types.Message

NewBenchMessage creates a message carrying information used to calc benchmarks on the other end of a transport.

func StartPrintingBenchmarks

func StartPrintingBenchmarks(period time.Duration, startIndex int32) chan<- Bench

StartPrintingBenchmarks starts a goroutine that will periodically print any statistics/benchmarks that are accumulated through messages, and also any lost interactions as per the startIndex. If you want to disable data loss detection then set the startIndex to -1. You must provide the messages via the write channel returned by the function.

Types

type Bench

type Bench struct {
	Latency int   // Time taken (ns) for a message to be received by a consumer.
	NBytes  int   // Number of bytes carried in the message.
	Index   int32 // The index carried by a message, can be used to detect loss.
}

Bench is a struct carrying message specific benchmarking statistics.

func BenchFromMessage

func BenchFromMessage(msg types.Message) (Bench, error)

BenchFromMessage returns the benchmarking stats from a message received.

Jump to

Keyboard shortcuts

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