counters

package
v0.0.0-...-dcb2eba Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeadersOnly uint8 = 0
	AllLayers   uint8 = 1
	PayloadOnly uint8 = 2
)
View Source
const (
	// QUICHeaderLen represents the minimum length in bytes to determine when a
	// QUIC upstream packet contains payload
	QUICHeaderLen = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailableCounters

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

AvailableCounters is a structure containing available Counter types

func (*AvailableCounters) Build

func (ac *AvailableCounters) Build(counters []string) (map[string]int, error)

Build iterates over the counter names that the program plans on using. If no type with such name is found or if the data type is not a counter interface an error is raised

func (*AvailableCounters) InstantiateById

func (ac *AvailableCounters) InstantiateById(counterId int) (Counter, error)

InstantiateById instantiates a new Counter of the type associated with code counterId

func (*AvailableCounters) InstantiateByName

func (ac *AvailableCounters) InstantiateByName(counterName string) (Counter, error)

InstantiateByName instantiates a new Counter of type with name counterName

type ByteCopyCounters

type ByteCopyCounters struct {
	CopiedBytes int32
	StoredBytes int32
	ToCopy      int32
	Layers      uint8
	Data        []byte
}

ByteCopy is a data structure to collect packet and byte counters

func (*ByteCopyCounters) AddPacket

func (c *ByteCopyCounters) AddPacket(pkt *network.Packet)

AddPacket increment the counters based on information contained in pkt

func (*ByteCopyCounters) Clear

func (c *ByteCopyCounters) Clear()

Clear clears all counters

func (*ByteCopyCounters) Collect

func (c *ByteCopyCounters) Collect() []byte

Collect returns a []byte representation of the counter

func (*ByteCopyCounters) Reset

func (c *ByteCopyCounters) Reset()

Reset resets all counters

func (*ByteCopyCounters) Type

func (c *ByteCopyCounters) Type() string

Type returns a string with the type name of the counter.

type ByteCopyCountersOut

type ByteCopyCountersOut struct {
	CopiedBytes int32
	Data        []byte
}

type Counter

type Counter interface {
	// Updates the flow states based on the packet
	AddPacket(pkt *network.Packet) error
	// Reset resets the counter statistics for periodic counting.
	// This function triggers at the "emit" time.
	Reset() error
	// Clear re-initializes the counter to its zero state
	Clear() error
	// Type returns a string with the type name of the counter.
	Type() string
	// Collect returns a []byte representation of the counter
	Collect() []byte
}

Counter is a general counter interface. Functions that all flow type structures have to implement.

type LatencyJitterCounter

type LatencyJitterCounter struct {
	RTT    welford.Welford
	Jitter welford.Welford
	// contains filtered or unexported fields
}

LatencyJitterCounter is a data structure to collect packet and byte counters

func (*LatencyJitterCounter) AddPacket

func (c *LatencyJitterCounter) AddPacket(pkt *network.Packet) error

func (*LatencyJitterCounter) Clear

func (c *LatencyJitterCounter) Clear() error

func (*LatencyJitterCounter) Collect

func (c *LatencyJitterCounter) Collect() []byte

Collect returns a []byte representation of the counter

func (*LatencyJitterCounter) Reset

func (c *LatencyJitterCounter) Reset() error

func (*LatencyJitterCounter) Type

func (c *LatencyJitterCounter) Type() string

Type returns a string with the type name of the counter.

type LatencyJitterCounterOut

type LatencyJitterCounterOut struct {
	RTTAvg    float64
	RTTVar    float64
	JitterAvg float64
	JitterVar float64
}

type PNGCopyCounters

type PNGCopyCounters struct {
	CopiedBytes int32
	StoredBytes int32
	ToCopy      int32
	Layers      uint8
	Image       *image.Gray
	Buffer      *bytes.Buffer
	Created     bool
}

ByteCopy is a data structure to collect packet and byte counters

func (*PNGCopyCounters) AddPacket

func (c *PNGCopyCounters) AddPacket(pkt *network.Packet)

AddPacket increment the counters based on information contained in pkt

func (*PNGCopyCounters) Clear

func (c *PNGCopyCounters) Clear()

Clear clears all counters

func (*PNGCopyCounters) Collect

func (c *PNGCopyCounters) Collect() []byte

Collect returns a []byte representation of the counter

func (*PNGCopyCounters) Reset

func (c *PNGCopyCounters) Reset()

Reset resets all counters

func (*PNGCopyCounters) Type

func (c *PNGCopyCounters) Type() string

Type returns a string with the type name of the counter.

type PNGCopyCountersOut

type PNGCopyCountersOut struct {
	CopiedBytes int32
	Data        []byte
}

type PacketCounters

type PacketCounters struct {
	InCounter  int64
	OutCounter int64
	InBytes    int64
	OutBytes   int64
}

PacketCounters is a data structure to collect packet and byte counters

func (*PacketCounters) AddPacket

func (c *PacketCounters) AddPacket(pkt *network.Packet) error

AddPacket increment the counters based on information contained in pkt

func (*PacketCounters) Clear

func (c *PacketCounters) Clear() error

Clear clears all counters (same behavior as reset)

func (*PacketCounters) Collect

func (c *PacketCounters) Collect() []byte

Collect returns a []byte representation of the counter

func (*PacketCounters) Reset

func (c *PacketCounters) Reset() error

Reset resets all counters

func (*PacketCounters) Type

func (c *PacketCounters) Type() string

Type returns a string with the type name of the counter.

type TCPState

type TCPState struct {
	AckUpCounter     int64
	AckDownCounter   int64
	SynUpCounter     int64
	SynDownCounter   int64
	RstUpCounter     int64
	RstDownCounter   int64
	PushUpCounter    int64
	PushDownCounter  int64
	UrgUpCounter     int64
	UrgDownCounter   int64
	BytesUpCounter   int64
	BytesDownCounter int64
	RetrUpCounter    int64
	RetrDownCounter  int64
	OOOUpCounter     int64
	OOODownCounter   int64

	UpRecWindow       welford.Welford
	DownRecWindow     welford.Welford
	UpBytesPerPkt     welford.Welford
	DownBytesPerPkt   welford.Welford
	UpBytesInFlight   welford.Welford
	DownBytesInFlight welford.Welford
	RTT               welford.Welford
	// contains filtered or unexported fields
}

TCPState is a data structure to collect packet and byte counters

func (*TCPState) AddPacket

func (c *TCPState) AddPacket(pkt *network.Packet) error

func (*TCPState) Clear

func (c *TCPState) Clear() error

func (*TCPState) Collect

func (c *TCPState) Collect() []byte

Collect returns a []byte representation of the counter

func (*TCPState) Reset

func (c *TCPState) Reset() error

func (*TCPState) Type

func (c *TCPState) Type() string

Type returns a string with the type name of the counter.

type TCPStateOut

type TCPStateOut struct {
	AckUpCounter     int64
	AckDownCounter   int64
	SynUpCounter     int64
	SynDownCounter   int64
	RstUpCounter     int64
	RstDownCounter   int64
	PushUpCounter    int64
	PushDownCounter  int64
	UrgUpCounter     int64
	UrgDownCounter   int64
	BytesUpCounter   int64
	BytesDownCounter int64
	RetrUpCounter    int64
	RetrDownCounter  int64
	OOOUpCounter     int64
	OOODownCounter   int64

	UpRecWindowAvg       float64
	DownRecWindowAvg     float64
	UpBytesPerPktAvg     float64
	DownBytesPerPktAvg   float64
	UpBytesInFlightAvg   float64
	DownBytesInFlightAvg float64
	RTTAvg               float64
	UpRecWindowVar       float64
	DownRecWindowVar     float64
	UpBytesPerPktVar     float64
	DownBytesPerPktVar   float64
	UpBytesInFlightVar   float64
	DownBytesInFlightVar float64
	RTTVar               float64
}

type VideoCounters

type VideoCounters struct {
	UpstreamChunks  []VideoSegment
	RunningUpstream VideoSegment
}

func (*VideoCounters) AddPacket

func (vf *VideoCounters) AddPacket(pkt *network.Packet) error

AddPacket updates the flow states based on the packet pkt

func (*VideoCounters) Clear

func (vf *VideoCounters) Clear() error

Clear the flow statistics

func (*VideoCounters) Collect

func (c *VideoCounters) Collect() []byte

Collect returns a []byte representation of the counter

func (*VideoCounters) Reset

func (vf *VideoCounters) Reset() error

Reset resets the flow statistics

func (*VideoCounters) Type

func (c *VideoCounters) Type() string

Type returns a string with the type name of the counter.

type VideoCountersOut

type VideoCountersOut struct {
	VideoSegments []VideoSegment
}

type VideoSegment

type VideoSegment struct {
	Len       int64
	Seq       int64
	TsStart   int64
	TsEnd     int64
	LastPkt   int64
	DownPkts  int64
	DonwBytes int64
	MaxDSeq   int64
}

VideoSegment is the data structure used to keep track of segments being downloaded

Jump to

Keyboard shortcuts

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