recorder

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Packet

type Packet struct {
	Size     int
	Sent     time.Time
	Received time.Time
}

type Record

type Record struct {
	// contains filtered or unexported fields
}

func NewRecord

func NewRecord() *Record

func (*Record) PacketReceived

func (s *Record) PacketReceived(id uint64, received time.Time)

func (*Record) PacketSent

func (s *Record) PacketSent(id uint64, size int, sent time.Time)

func (*Record) Stats

func (s *Record) Stats() *Stats

type Stats

type Stats struct {
	// Latencies is a map latency per nanosecond.
	Latencies map[int64]time.Duration
	// Bandwidths is a map of bandwidth per nanosecond.
	Bandwidths map[int64]float64
	// TotalSent is the total number of packets sent.
	TotalSent int
	// TotalReceived is the total number of packets received.
	TotalReceived int
}

Stats contains the statistics of a transfer.

func (*Stats) Bandwidth

func (s *Stats) Bandwidth() float64

Bandwidth returns the bandwidth in bytes per second. The serie is IQR filtered, and mean is calculated.

func (*Stats) Latency

func (s *Stats) Latency() time.Duration

Latency returns the average latency. The serie is IQR filtered, and mean is calculated.

func (*Stats) PacketLoss

func (s *Stats) PacketLoss() float64

PacketLoss returns the percentage of packets lost.

type TransferMetric

type TransferMetric struct {
	Received time.Time
	Sent     time.Time
	Bytes    int
}

Jump to

Keyboard shortcuts

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