timeRoundedCounter

package
v0.0.0-...-e50112c Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterInterface

type CounterInterface interface {
	Name() string
	Round() time.Duration
	GetAll(rtrimZero ...bool) []CounterItem
}

func AllNamedCounter

func AllNamedCounter() []CounterInterface

type CounterItem

type CounterItem interface {
	IsZero() bool
	Reset()
}

type CustomCounter

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

func NewCustom

func NewCustom(name string, round time.Duration, capacity int, newItem func() CounterItem) *CustomCounter

func (*CustomCounter) Add

func (this *CustomCounter) Add(f func(v CounterItem), t ...time.Time)

设置计数器的值

Perf:

[perf-1s]  total=14877334,  avg=14877334/s,  mrt=67ns

func (*CustomCounter) Capacity

func (this *CustomCounter) Capacity() int

func (*CustomCounter) GetAll

func (this *CustomCounter) GetAll(rtrimZero ...bool) []CounterItem

Perf:

[perf-1s] total=1720411,  avg=1720411/s,  mrt=581ns

func (*CustomCounter) GetN

func (this *CustomCounter) GetN(t time.Time, offset, limit int, rtrimZero ...bool) []CounterItem

func (*CustomCounter) Name

func (this *CustomCounter) Name() string

func (*CustomCounter) Round

func (this *CustomCounter) Round() time.Duration

type MRTCountValue

type MRTCountValue struct {
	Count int
	MRT   time.Duration
}

type MRTCounterItem

type MRTCounterItem interface {
	CounterItem

	MRTValues() []*MRTCountValue
}

type PropertyCounter

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

func NewProperty

func NewProperty(name string, round time.Duration, capacity int) *PropertyCounter

func (*PropertyCounter) Add

func (this *PropertyCounter) Add(property string, n int, t ...time.Time)

func (*PropertyCounter) GetAll

func (this *PropertyCounter) GetAll(rtrimZero ...bool) []CounterItem

func (*PropertyCounter) ItemProperties

func (this *PropertyCounter) ItemProperties() []string

func (*PropertyCounter) Max

func (this *PropertyCounter) Max(property string, n int, t ...time.Time)

func (*PropertyCounter) Min

func (this *PropertyCounter) Min(property string, n int, t ...time.Time)

func (*PropertyCounter) Name

func (this *PropertyCounter) Name() string

func (*PropertyCounter) Round

func (this *PropertyCounter) Round() time.Duration

func (*PropertyCounter) Set

func (this *PropertyCounter) Set(property string, n int, t ...time.Time)

func (*PropertyCounter) SetPropertyNames

func (this *PropertyCounter) SetPropertyNames(autoSort bool, property ...string) *PropertyCounter

type PropertyCounterInterface

type PropertyCounterInterface interface {
	CounterInterface

	ItemProperties() []string
}

type PropertyCounterItem

type PropertyCounterItem interface {
	CounterItem

	Values() []interface{}
}

type PropertyMRTCounter

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

func NewPropertyMRT

func NewPropertyMRT(name string, round time.Duration, capacity int) *PropertyMRTCounter

func (*PropertyMRTCounter) Add

func (this *PropertyMRTCounter) Add(property string, n int, d time.Duration, t ...time.Time)

func (*PropertyMRTCounter) AddF

func (this *PropertyMRTCounter) AddF(f func(a *PropertyMrtCountItem))

func (*PropertyMRTCounter) GetAll

func (this *PropertyMRTCounter) GetAll(rtrimZero ...bool) []CounterItem

func (*PropertyMRTCounter) GetAllMRT

func (this *PropertyMRTCounter) GetAllMRT(rtrimZero ...bool) []MRTCounterItem

func (*PropertyMRTCounter) ItemProperties

func (this *PropertyMRTCounter) ItemProperties() []string

func (*PropertyMRTCounter) Name

func (this *PropertyMRTCounter) Name() string

func (*PropertyMRTCounter) Round

func (this *PropertyMRTCounter) Round() time.Duration

func (*PropertyMRTCounter) Set

func (this *PropertyMRTCounter) Set(property string, n int, d time.Duration, t ...time.Time)

func (*PropertyMRTCounter) SetPropertyNames

func (this *PropertyMRTCounter) SetPropertyNames(autoSort bool, property ...string) *PropertyMRTCounter

type PropertyMrtCountItem

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

func (*PropertyMrtCountItem) Add

func (this *PropertyMrtCountItem) Add(property string, n int, d time.Duration)

func (*PropertyMrtCountItem) IsZero

func (this *PropertyMrtCountItem) IsZero() bool

func (*PropertyMrtCountItem) MRTValues

func (this *PropertyMrtCountItem) MRTValues() []*MRTCountValue

func (*PropertyMrtCountItem) Properties

func (this *PropertyMrtCountItem) Properties() []string

func (*PropertyMrtCountItem) Reset

func (this *PropertyMrtCountItem) Reset()

func (*PropertyMrtCountItem) Set

func (this *PropertyMrtCountItem) Set(property string, n int, d time.Duration)

func (*PropertyMrtCountItem) Values

func (this *PropertyMrtCountItem) Values() []interface{}

type SimpleCounter

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

func NewSimple

func NewSimple(name string, round time.Duration, capacity int) *SimpleCounter

func (*SimpleCounter) Add

func (this *SimpleCounter) Add(n int, t ...time.Time)

func (*SimpleCounter) GetAll

func (this *SimpleCounter) GetAll(rtrimZero ...bool) []CounterItem

func (*SimpleCounter) ItemProperties

func (this *SimpleCounter) ItemProperties() []string

func (*SimpleCounter) Name

func (this *SimpleCounter) Name() string

func (*SimpleCounter) Round

func (this *SimpleCounter) Round() time.Duration

type StepMRTCounter

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

func NewStepMRT

func NewStepMRT(name string, round time.Duration, capacity int, step ...time.Duration) *StepMRTCounter

func (*StepMRTCounter) Add

func (this *StepMRTCounter) Add(n int, d time.Duration, t ...time.Time)

func (*StepMRTCounter) GetAll

func (this *StepMRTCounter) GetAll(rtrimZero ...bool) []CounterItem

func (*StepMRTCounter) GetAllMRT

func (this *StepMRTCounter) GetAllMRT(rtrimZero ...bool) []MRTCounterItem

func (*StepMRTCounter) ItemProperties

func (this *StepMRTCounter) ItemProperties() []string

func (*StepMRTCounter) Name

func (this *StepMRTCounter) Name() string

func (*StepMRTCounter) Round

func (this *StepMRTCounter) Round() time.Duration

func (*StepMRTCounter) SetStepFormat

func (this *StepMRTCounter) SetStepFormat(f func(step time.Duration) string) *StepMRTCounter

func (*StepMRTCounter) Steps

func (this *StepMRTCounter) Steps() []time.Duration

Jump to

Keyboard shortcuts

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