speeds

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package speeds 速度计算工具包

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateLimit

type RateLimit struct {
	MaxRate int64
	// contains filtered or unexported fields
}

func NewRateLimit

func NewRateLimit(maxRate int64) *RateLimit

func (*RateLimit) Add

func (rl *RateLimit) Add(count int64)

func (*RateLimit) SetInterval

func (rl *RateLimit) SetInterval(i time.Duration)

func (*RateLimit) Stop

func (rl *RateLimit) Stop()

type Speeds

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

Speeds 统计速度

func (*Speeds) Add

func (sps *Speeds) Add(count int64)

Add 原子操作, 增加数据量

func (*Speeds) GetSpeeds

func (sps *Speeds) GetSpeeds() (speeds int64)

GetSpeeds 结束统计速度, 并返回速度

func (*Speeds) SetInterval

func (sps *Speeds) SetInterval(interval time.Duration)

SetInterval 设置刷新周期

Jump to

Keyboard shortcuts

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