bench

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	ReportData
	// contains filtered or unexported fields
}

Report 是报表核心数据结构

func NewReport

func NewReport(ctx context.Context,
	c, n int,

	duration time.Duration,

	getRequest func() (*http.Request, error),

	client *http.Client) *Report

NewReport is a report initialization function

func (*Report) Cancel

func (r *Report) Cancel()

Cancel report logic

func (*Report) Init

func (r *Report) Init()

Init 初始化报表模块, 后台会起一个统计go程

func (*Report) Process

func (r *Report) Process(work chan struct{})

Process 负责构造压测http 链接和统计压测元数据

func (*Report) WaitAll

func (r *Report) WaitAll()

WaitAll 等待结束

type ReportData

type ReportData struct {
	SendNum int // 已经发送的http 请求

	Number int // 发送总次数

	*http.Client
	// contains filtered or unexported fields
}

type SubTasker

type SubTasker interface {
	Init()
	Process(chan struct{})
	Cancel()
	WaitAll()
}

SubTasker 是task模块的核心接口

type Task

type Task struct {
	Duration   time.Duration //压测时间
	Number     int           //压测次数
	Concurrent int           //并发数
	Rate       int           //压测频率
	// contains filtered or unexported fields
}

Task Task模块的核心数据结构

func (*Task) Run

func (t *Task) Run(sub SubTasker)

Run Task模块的入口函数

Jump to

Keyboard shortcuts

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