latency

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Measurement

type Measurement struct {
	Host    string
	Port    int
	Timeout int
	Runs    int
	Wait    int
	// contains filtered or unexported fields
}

Measurements represents a new tcplatency measurement

func NewMeasurement

func NewMeasurement(host string, port int, timeout int, runs int, wait int) *Measurement

func (*Measurement) AvgLatency

func (m *Measurement) AvgLatency() float64

AvgLatency returns the average tcp latency

func (*Measurement) DialTCP

func (m *Measurement) DialTCP() *TCPResponse

DialTCP calculates a latency point using sockets.

func (*Measurement) IsFinished

func (m *Measurement) IsFinished() bool

IsFinished returns true when all tcp ping runs have been executed, false if not

func (*Measurement) MaxLatency

func (m *Measurement) MaxLatency() float64

MaxLatency returns the max latency

func (*Measurement) MinLatency

func (m *Measurement) MinLatency() float64

MinLatency returns the min latency

func (*Measurement) Result

func (m *Measurement) Result() MeasurementResult

Result returns a new measurement result. Can be used to summarize results of multiple measurements

func (*Measurement) StdDevLatency

func (m *Measurement) StdDevLatency() float64

StdDevLatency calculates an average of how far each latency is from the mean latency. The higher MedianDerivation is, the more variable the latency is over time.

type MeasurementResult

type MeasurementResult struct {
	Successful int
	Failed     int
	Count      int
	Average    float64
	Max        float64
	Min        float64
	StdDev     float64
}

MeasurementResult represents a new measurement result

func Measure

func Measure(host string, port int, timeout int, runs int, wait int) MeasurementResult

type TCPResponse

type TCPResponse struct {
	Host     string
	Port     int
	Sequence int
	Timeout  int
	Latency  float64
	Failed   bool
}

func (*TCPResponse) String

func (tcp *TCPResponse) String() string

Jump to

Keyboard shortcuts

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