statistic

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Decimal128ToFloat64Scale = 5
	Float64PrecForMemorySize = 3
)
View Source
const (
	StatsArrayVersion = StatsArrayVersion3

	StatsArrayVersion0 = 0 // raw statistics
	StatsArrayVersion1 = 1 // float64 array
	StatsArrayVersion2 = 2 // float64 array + plus one elem OutTrafficBytes
	StatsArrayVersion3 = 3 // ... + one elem: ConnType
)
View Source
const (
	StatsArrayIndexVersion = iota
	StatsArrayIndexTimeConsumed
	StatsArrayIndexMemorySize
	StatsArrayIndexS3IOInputCount
	StatsArrayIndexS3IOOutputCount // index: 4
	StatsArrayIndexOutTrafficBytes // index: 5
	StatsArrayIndexConnType        // index: 6

	StatsArrayLength
)
View Source
const (
	StatsArrayLengthV1 = 5
	StatsArrayLengthV2 = 6
	StatsArrayLengthV3 = 7
)

Variables

View Source
var DefaultStatsArray = *initStatsArray.Init()
View Source
var DefaultStatsArrayJsonString = initStatsArray.Init().ToJsonString()

Functions

func StatsArrayToJsonString

func StatsArrayToJsonString(arr []float64) []byte

StatsArrayToJsonString return json arr format example: [1,0,0,0,0] got `[1,0,0,0,0]` [1,2,3,4,5] got `[1,2,3.000,4,5]` [2,1,2,3,4,5] got `[2,3.000,4,5,6.000,7]`

Types

type ConnType

type ConnType float64
const (
	ConnTypeUnknown  ConnType = 0
	ConnTypeInternal ConnType = 1
	ConnTypeExternal ConnType = 2
)

type StatsArray

type StatsArray [StatsArrayLength]float64

func NewStatsArray

func NewStatsArray() *StatsArray

func NewStatsArrayV1

func NewStatsArrayV1() *StatsArray

func NewStatsArrayV2

func NewStatsArrayV2() *StatsArray

func NewStatsArrayV3

func NewStatsArrayV3() *StatsArray

func (*StatsArray) Add

func (s *StatsArray) Add(delta *StatsArray) *StatsArray

Add do add two stats array together except for Element ConnType, which idx = StatsArrayIndexConnType, just keep s[StatsArrayIndexConnType] value.

func (*StatsArray) GetConnType

func (s *StatsArray) GetConnType() float64

func (*StatsArray) GetMemorySize

func (s *StatsArray) GetMemorySize() float64

func (*StatsArray) GetOutTrafficBytes

func (s *StatsArray) GetOutTrafficBytes() float64

func (*StatsArray) GetS3IOInputCount

func (s *StatsArray) GetS3IOInputCount() float64

func (*StatsArray) GetS3IOOutputCount

func (s *StatsArray) GetS3IOOutputCount() float64

func (*StatsArray) GetTimeConsumed

func (s *StatsArray) GetTimeConsumed() float64

func (*StatsArray) GetVersion

func (s *StatsArray) GetVersion() float64

func (*StatsArray) Init

func (s *StatsArray) Init() *StatsArray

func (*StatsArray) InitIfEmpty

func (s *StatsArray) InitIfEmpty() *StatsArray

func (*StatsArray) Reset

func (s *StatsArray) Reset() *StatsArray

func (*StatsArray) ToJsonString

func (s *StatsArray) ToJsonString() []byte

func (*StatsArray) WithConnType

func (s *StatsArray) WithConnType(v ConnType) *StatsArray

func (*StatsArray) WithMemorySize

func (s *StatsArray) WithMemorySize(v float64) *StatsArray

func (*StatsArray) WithOutTrafficBytes

func (s *StatsArray) WithOutTrafficBytes(v float64) *StatsArray

func (*StatsArray) WithS3IOInputCount

func (s *StatsArray) WithS3IOInputCount(v float64) *StatsArray

func (*StatsArray) WithS3IOOutputCount

func (s *StatsArray) WithS3IOOutputCount(v float64) *StatsArray

func (*StatsArray) WithTimeConsumed

func (s *StatsArray) WithTimeConsumed(v float64) *StatsArray

func (*StatsArray) WithVersion

func (s *StatsArray) WithVersion(v float64) *StatsArray

WithVersion set the version array in StatsArray, please carefully to use.

Jump to

Keyboard shortcuts

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