Documentation ¶
Index ¶
- Constants
- Variables
- func New[T any](t T) *T
- func StartBench(ctx context.Context, fn Benchable, fns ...ConfigFn)
- type BenchEmpty
- type BenchOption
- type Benchable
- type Charts
- type ChartsReport
- type Config
- type ConfigFn
- type F
- type Metrics
- type PercentileReport
- type Printer
- type Report
- type ReportRecord
- type Requester
- type Result
- type SnapshotHistogram
- type SnapshotPercentile
- type SnapshotReport
- type SnapshotRpsStats
- type SnapshotStats
- type StatItem
- type Stats
- type StatsReport
- type StreamReport
- type SummaryReport
- type Views
Constants ¶
View Source
const ( ViewTpl = ` $(function () { {{ .SetInterval }}(views_sync, {{ .Interval }}); }); let views = {{.ViewsMap}}; {{.ViewSyncJS}} ` PageTpl = `` /* 362-byte string literal not displayed */ )
View Source
const ( FgBlackColor int = iota + 30 FgRedColor FgGreenColor FgYellowColor FgBlueColor FgMagentaColor FgCyanColor FgWhiteColor )
View Source
const ( AlignLeft = iota AlignRight AlignCenter )
Variables ¶
View Source
var Demo = false
Demo tells the underlying benchmark is only a demo.
View Source
var ErrNoop = errors.New("noop")
ErrNoop means there is no operation defined.
View Source
var (
IsStdoutTerminal = isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd())
)
Functions ¶
Types ¶
type Benchable ¶
type Benchable interface { Name(context.Context, *Config) string Init(context.Context, *Config) (*BenchOption, error) Invoke(context.Context, *Config) (*Result, error) Final(context.Context, *Config) error }
Benchable abstract interface for benchmark.
type Charts ¶
type Charts struct {
// contains filtered or unexported fields
}
func NewCharts ¶
func NewCharts(chartsData func() *ChartsReport, config *Config) *Charts
func (*Charts) Handler ¶
func (c *Charts) Handler(ctx *fasthttp.RequestCtx)
type ChartsReport ¶
type Config ¶
type Config struct { util.Features PlotsHandle util.JSONLogger OkStatus string Desc string PlotsFile string FeaturesConf string CountingName string ThinkTime string Incr util.GoroutineIncr ChartPort int Duration time.Duration Verbose int N int QPS float64 Goroutines int GoMaxProcs int }
Config defines the bench configuration.
func (*Config) Description ¶
func (*Config) IsDryPlots ¶
type ConfigFn ¶
type ConfigFn func(*Config)
ConfigFn defines the config function.
func WithOkStatus ¶
WithOkStatus set the status which represents OK.
type PercentileReport ¶
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
func (*Printer) PrintLoop ¶
func (p *Printer) PrintLoop(snapshot func() *SnapshotReport, doneChan <-chan struct{}, requests int)
type Report ¶
type Report struct { PercentileReport `json:"Percentile"` StatsReport `json:"Stats"` SummaryReport `json:"Summary"` }
type ReportRecord ¶
type ReportRecord struct {
// contains filtered or unexported fields
}
func (*ReportRecord) Reset ¶
func (r *ReportRecord) Reset()
type Requester ¶
type Requester struct { // QPS is the rate limit in queries per second. QPS float64 // contains filtered or unexported fields }
Requester is request structure.
type Result ¶
type Result struct { Status []string Counting []string ReadBytes int64 WriteBytes int64 Cost time.Duration AssertFail int64 }
Result defines the benchmark result.
type SnapshotHistogram ¶
type SnapshotPercentile ¶
type SnapshotReport ¶
type SnapshotReport struct { Stats *SnapshotStats Codes, Errors map[string]int64 RpsStats *SnapshotRpsStats Histograms []*SnapshotHistogram Percentiles []*SnapshotPercentile RPS, ElapseInSec float64 Count, Counting int64 ReadBytes, WriteBytes int64 AssertFail int64 Elapsed time.Duration }
type SnapshotRpsStats ¶
type SnapshotRpsStats struct {
Min, Mean, StdDev, Max float64
}
type SnapshotStats ¶
type StatsReport ¶
type StreamReport ¶
type StreamReport struct {
// contains filtered or unexported fields
}
func NewStreamReport ¶
func NewStreamReport(requester *Requester) *StreamReport
func (*StreamReport) Charts ¶
func (s *StreamReport) Charts() *ChartsReport
func (*StreamReport) Collect ¶
func (s *StreamReport) Collect(recordChan <-chan *ReportRecord)
func (*StreamReport) Done ¶
func (s *StreamReport) Done() <-chan struct{}
func (*StreamReport) Snapshot ¶
func (s *StreamReport) Snapshot() *SnapshotReport
type SummaryReport ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
fgrpc
|
|
pkg
|
|
blow/lossy
Package lossy simulates bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces.
|
Package lossy simulates bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces. |
Click to show internal directories.
Click to hide internal directories.