proc

package
v3.15.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOtherMaxSize      = 100 // 默认的 自定义统计字段的最大值
	DefaultSCounterQpsPeriod = 1   // QPS计算周期, 默认值为1s
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SCounterBase

type SCounterBase struct {
	sync.RWMutex
	Name string
	Cnt  int64
	Time string

	// 自定义统计指标
	Other map[string]interface{}
	// contains filtered or unexported fields
}

基本的计数器

func NewSCounterBase

func NewSCounterBase(name string) *SCounterBase

func (*SCounterBase) Get

func (this *SCounterBase) Get() *SCounterBase

func (*SCounterBase) PutOther

func (this *SCounterBase) PutOther(key string, value interface{}) bool

func (*SCounterBase) Set

func (this *SCounterBase) Set(cnt int64)

to be abandoned

func (*SCounterBase) SetCnt

func (this *SCounterBase) SetCnt(cnt int64)

type SCounterQps

type SCounterQps struct {
	sync.RWMutex
	Name string
	Cnt  int64
	Qps  int64
	Time string

	// 自定义统计指标
	Other map[string]interface{}
	// contains filtered or unexported fields
}

QPS统计,只支持 增加计数操作

func NewSCounterQps

func NewSCounterQps(name string) *SCounterQps

func (*SCounterQps) Get

func (this *SCounterQps) Get() *SCounterQps

func (*SCounterQps) Incr

func (this *SCounterQps) Incr()

func (*SCounterQps) IncrBy

func (this *SCounterQps) IncrBy(incr int64)

func (*SCounterQps) PutOther

func (this *SCounterQps) PutOther(key string, value interface{}) bool

Jump to

Keyboard shortcuts

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