bench

package
v0.0.0-...-d309772 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexClient = 1
	IndexServer = 2
)

Variables

This section is empty.

Functions

func Marshal

func Marshal(p *Pack) []byte

Marshal ...

Types

type Agent

type Agent interface {
	GetAgent(index int) (what.Agent, error)
}

Agent ... 配置并代理 what.Agent

type Client

type Client struct {
	Agent Agent //starter:inject("#")

	ServiceName string //starter:inject("${benchmark.client.service}")
	Enabled     bool   //starter:inject("${benchmark.client.enabled}")
	Interval    int    //starter:inject("${benchmark.client.interval}")
	RequestX    int    //starter:inject("${benchmark.client.request-x}")
	ResponseX   int    //starter:inject("${benchmark.client.response-x}")
	PayloadSize int    //starter:inject("${benchmark.client.payload-size}")
	RemoteURL   string //starter:inject("${benchmark.client.remote-url}")

}

Client ...

func (*Client) Life

func (inst *Client) Life() *application.Life

Life ...

type Counter

type Counter struct {
	RxBytes int64     `json:"rx_bytes"`
	RxPacks int64     `json:"rx_packs"`
	TxBytes int64     `json:"tx_bytes"`
	TxPacks int64     `json:"tx_packs"`
	Startup lang.Time `json:"startup"`
	Now     lang.Time `json:"now"`
}

Counter ... 收发数据计数器

func ParseCounter

func ParseCounter(b []byte) (*Counter, error)

ParseCounter ... 解析 JSON 形式的 Counter

func (*Counter) Bytes

func (inst *Counter) Bytes() []byte

Bytes ... 把 Counter 编码为 JSON 形式

type Pack

type Pack struct {
	Type      PackType
	RequestX  int
	ResponseX int
	// contains filtered or unexported fields
}

Pack ...

func Unmarshal

func Unmarshal(raw []byte) (*Pack, error)

Unmarshal ...

func (*Pack) GetHeader

func (inst *Pack) GetHeader(name string) string

GetHeader ...

func (*Pack) SetHeader

func (inst *Pack) SetHeader(name, value string)

SetHeader ...

type PackType

type PackType string

PackType ...

const (
	TypeCountRequest    PackType = "count.req"
	TypeCountResponse   PackType = "count.resp"
	TypePayloadRequest  PackType = "payload.req"
	TypePayloadResponse PackType = "payload.resp"
)

define PackType(s) ...

func (PackType) String

func (t PackType) String() string

type ProxyAgent

type ProxyAgent struct {
	Host1 string //starter:inject("${benchmark.core1.host}")
	Port1 int    //starter:inject("${benchmark.core1.port}")

	Host2 string //starter:inject("${benchmark.core2.host}")
	Port2 int    //starter:inject("${benchmark.core2.port}")
	// contains filtered or unexported fields
}

ProxyAgent ... 实现: Agent

func (*ProxyAgent) GetAgent

func (inst *ProxyAgent) GetAgent(index int) (what.Agent, error)

GetAgent ...

type Server

type Server struct {
	Agent Agent //starter:inject("#")

	ServiceName string //starter:inject("${benchmark.server.service}")
	Enabled     bool   //starter:inject("${benchmark.server.enabled}")

}

Server ...

func (*Server) Life

func (inst *Server) Life() *application.Life

Life ...

Jump to

Keyboard shortcuts

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