statistic

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2018 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 Detail

type Detail struct {
	ID    int
	Title string

	Total    int
	ErrCount int
	Cost     []int
	Dead     bool
	// contains filtered or unexported fields
}

Detail provide ability for statistic

func (*Detail) DealRecord

func (s *Detail) DealRecord(t time.Time, record types.Record)

DealRecord deal new record at t

func (*Detail) LastAverageCost

func (s *Detail) LastAverageCost() int64

LastAverageCost represents latest speed in window

func (*Detail) LastErrRate

func (s *Detail) LastErrRate() float64

LastErrRate represents latest error rate in window

func (*Detail) LastErrRateLevel added in v0.4.0

func (s *Detail) LastErrRateLevel() int

LastErrRateLevel represents the level of last error rate

func (*Detail) LastErrorRecord

func (s *Detail) LastErrorRecord() *ErrorRecordAt

LastErrorRecord represents latest error record

func (*Detail) LastRecord

func (s *Detail) LastRecord() *RecordAt

LastRecord represents latest record

func (*Detail) LastStatisticLatencyLow added in v0.4.0

func (s *Detail) LastStatisticLatencyLow() bool

LastStatisticLatencyLow represents last average cose is lower than threshold

func (*Detail) ResizeViewWindow

func (s *Detail) ResizeViewWindow(size int)

ResizeViewWindow resize view window to size

func (*Detail) RetireRecord

func (s *Detail) RetireRecord(t time.Time)

RetireRecord retires those records out of window

type ErrorRecordAt

type ErrorRecordAt struct {
	T   time.Time
	Err string
}

ErrorRecordAt error record

type RecordAt

type RecordAt struct {
	T      time.Time
	Record types.Record
}

RecordAt represents Record generated of the iteration

func (*RecordAt) View

func (r *RecordAt) View() interface{}

View of record

type SortStrategy

type SortStrategy int

SortStrategy represents how to sort statistics

const (
	Default SortStrategy = iota
)

Provided strategys

type StSlice

type StSlice struct {
	Details      []*Detail
	SortStrategy SortStrategy
}

StSlice helps sort statistics

func (StSlice) Len

func (st StSlice) Len() int

Len of statistics

func (StSlice) Less

func (st StSlice) Less(i, j int) bool

Less compares statistics

func (StSlice) Swap

func (st StSlice) Swap(i, j int)

Swap btw two statistics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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