log

package
v0.0.0-...-465a192 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_LATENCY_STORED = 100

This class hold latencies values, and performs the average/std distribution of it. That is the max number of value stored.

Variables

This section is empty.

Functions

func ConfidenceInterval95

func ConfidenceInterval95(data []int64) float64

Confidence95Percentiles returns the delta for the 95% confidence interval. The actual interval is [mean(x)-delta; mean(x)+delta]

func DecodeLatencyMessages

func DecodeLatencyMessages(buffer []byte, clientID int, receptionRoundID int32, actionFunction func(int32, int32, int64))

DecodeLatencyMessages tries to decode Latency messages, and calls actionFunction with (originalRoundId, roundDiff, timeDiff) for every found message

func MeanFloat64

func MeanFloat64(data []float64) float64

MeanFloat64 returns the mean for a []float64

func MeanInt64

func MeanInt64(data []int64) float64

MeanInt64 returns the mean for a []int64

func MsTimeStamp

func MsTimeStamp(t time.Time) int64

MsTimeStamp converts time.Time into int64

func MsTimeStampNow

func MsTimeStampNow() int64

MsTimeStampNow returns the current timestamp, in milliseconds.

func Round

func Round(f float64) float64

Round rounds up a float64, without digits after the comma

func RoundWithPrecision

func RoundWithPrecision(f float64, places int) float64

RoundWithPrecision rounds up a float64, with a specified amount of digits after the comma

Types

type BitrateStatistics

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

BitrateStatistics holds statistics about the bitrate, such as instant/total up/down/down (via udp)/retransmitted bits

func NewBitRateStatistics

func NewBitRateStatistics(cellSize int) *BitrateStatistics

NewBitRateStatistics create a new BitrateStatistics struct, with a period (for reporting) of 5 second

func (*BitrateStatistics) AddDownstreamCell

func (stats *BitrateStatistics) AddDownstreamCell(nBytes int64)

AddDownstreamCell adds N bytes to the count of downstream bits

func (*BitrateStatistics) AddDownstreamRetransmitCell

func (stats *BitrateStatistics) AddDownstreamRetransmitCell(nBytes int64)

AddDownstreamRetransmitCell adds N bytes to the count of retransmitted bits

func (*BitrateStatistics) AddDownstreamUDPCell

func (stats *BitrateStatistics) AddDownstreamUDPCell(nBytes int64, nclients int)

AddDownstreamUDPCell adds N bytes to the count of downstream (via udp) bits

func (*BitrateStatistics) AddUpstreamCell

func (stats *BitrateStatistics) AddUpstreamCell(nBytes int64)

AddUpstreamCell adds N bytes to the count of upstream bits

func (*BitrateStatistics) Dump

func (stats *BitrateStatistics) Dump()

Dump prints all the contents of the BitrateStatistics

func (*BitrateStatistics) Report

func (stats *BitrateStatistics) Report() string

Report prints (if t>period=5 seconds have passed since the last report) all the information, without extra data

func (*BitrateStatistics) ReportWithInfo

func (stats *BitrateStatistics) ReportWithInfo(info string) string

ReportWithInfo prints (if t>period=5 seconds have passed since the last report) all the information, with extra data "info"

type LatencyTestToSend

type LatencyTestToSend struct {
	CreatedAt time.Time
}

One buffered latency test message. We only need to store the "createdAt" time.

func LatencyMessagesToBytes

func LatencyMessagesToBytes(msgs []*LatencyTestToSend, clientID int, roundID int32, payLoadLength int, reportFunction func(int64)) ([]byte, []*LatencyTestToSend)

LatencyMessagesToBytes encoded the Latency messages in "msgs", returns the encoded bytes and the new "msgs" without the successfully-encoded messages

type LatencyTests

type LatencyTests struct {
	DoLatencyTests       bool
	LatencyTestsInterval time.Duration
	NextLatencyTest      time.Time
	LatencyTestsToSend   []*LatencyTestToSend
}

Regroups the information about doing latency tests

type SchedulesStatistics

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

LatencyStatistics holds the latencies reported

func NewSchedulesStatistics

func NewSchedulesStatistics() *SchedulesStatistics

NewSchedulesStatistics create a new TimeStatistics struct, with a period (for reporting) of 5 second

func (*SchedulesStatistics) AddSchedule

func (stats *SchedulesStatistics) AddSchedule(newSchedule map[int]bool)

AddLatency adds a latency to the stored latency array, and removes the oldest one if there are more than MAX_LATENCY_STORED

func (*SchedulesStatistics) Report

func (stats *SchedulesStatistics) Report() string

Report prints (if t>period=5 seconds have passed since the last report) all the information, without extra data

func (*SchedulesStatistics) ReportWithInfo

func (stats *SchedulesStatistics) ReportWithInfo(info string) string

ReportWithInfo prints (if t>period=5 seconds have passed since the last report) all the information, with extra data

type TimeStatistics

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

LatencyStatistics holds the latencies reported

func NewTimeStatistics

func NewTimeStatistics() *TimeStatistics

NewLatencyStatistics create a new LatencyStatistics struct, with a period (for reporting) of 5 second

func (*TimeStatistics) AddTime

func (stats *TimeStatistics) AddTime(latency int64)

AddLatency adds a latency to the stored latency array, and removes the oldest one if there are more than MAX_LATENCY_STORED

func (*TimeStatistics) Report

func (stats *TimeStatistics) Report() string

Report prints (if t>period=5 seconds have passed since the last report) all the information, without extra data

func (*TimeStatistics) ReportWithInfo

func (stats *TimeStatistics) ReportWithInfo(info string) string

ReportWithInfo prints (if t>period=5 seconds have passed since the last report) all the information, with extra data

func (*TimeStatistics) TimeStatistics

func (stats *TimeStatistics) TimeStatistics() (string, string, string)

LatencyStatistics returns a triplet (mean, variance, number of samples) as formatted strings (2-digit precision)

Jump to

Keyboard shortcuts

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