Documentation
¶
Overview ¶
Package gompet (Go Multi-purpose Performance Evaluation Tool) provides a multi-core benchmarking skeleton for use in different benchmarking clients. See sub-folders for some example command line clients.
Index ¶
- func ClientRoutine(id int, client Client)
- func CollectResults(results *Results)
- func FeedArgs(reader *csv.Reader) error
- func FeedCmds(reader io.Reader) error
- func FormatDecimals(v float64) string
- func LaunchClients(clientFactory ClientFactory) error
- func OpenInput() (io.Reader, *os.File)
- func Percentile(input []float64, percent float64) (percentile float64)
- func PrintMap(heading string, m map[string]int64)
- func PrintPercentile(input []float64, percent float64)
- func Run(clientFactory ClientFactory)
- func Setup()
- type Client
- type ClientConfig
- type ClientFactory
- type ClientInput
- type ClientResult
- type Results
- type VarTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientRoutine ¶
ClientRoutine is the processing function for data processing
func CollectResults ¶
func CollectResults(results *Results)
CollectResults listens for processing results and updates the results
func FormatDecimals ¶
FormatDecimals returns the value as a string with "nice" number of decimals
func LaunchClients ¶
func LaunchClients(clientFactory ClientFactory) error
LaunchClients creates clients and starts the go routines for data processing
func Percentile ¶
Percentile finds the value at given percent in the input which must be pre-sorted Adapted from https://github.com/montanaflynn/stats/blob/master/percentile.go
func PrintMap ¶
PrintMap outputs heading and map key values in increasing alphabetical order of keys
func PrintPercentile ¶
PrintPercentile outputs the percent's percentile from input
func Run ¶
func Run(clientFactory ClientFactory)
Run function executes the commands and reports results
Types ¶
type Client ¶
type Client interface {
RunCommand(in *ClientInput) *ClientResult
Term()
}
Client is the interface the client must implement
type ClientConfig ¶
type ClientConfig struct {
ID int
Template *VarTemplate
NumClients int
Verbose bool
}
ClientConfig is passed to the client factory when a new instance is created
type ClientFactory ¶
type ClientFactory func(config ClientConfig) (Client, error)
ClientFactory creates a client instance
type ClientInput ¶
type ClientInput struct {
Cmd string // command to execute, nil if template
Args []string // variables values for template if cmd==nil
}
ClientInput is given to client once per input command
type ClientResult ¶
type ClientResult struct {
Res string // result, count of each separate value is reported
Time float64 // execution time in seconds, percentiles are reported
Err error // error result or nil, count of each error is reported (if any)
}
ClientResult is returned from client after processing one input line
type Results ¶
type Results struct {
Start time.Time
LastProgress time.Time
LastStats time.Time
Elapsed float64
PeriodicStats int
Progress bool
Count int64
LastCount int64
Times []float64
Results map[string]int64
Errs map[string]int64
}
Results collects overall statistics
func Exec ¶
func Exec(clientFactory ClientFactory) *Results
Exec executes the commands, global flags must have been set up before this
func NewResults ¶
NewResults returns a newly initialized Results
func (*Results) PercentileRow ¶
PercentileRow formats a row of percentiles from results
func (*Results) PercentileRowHeader ¶
PercentileRowHeader returns the header for the stats rows
func (*Results) Update ¶
func (results *Results) Update(res *ClientResult)
Update results from one Run
type VarTemplate ¶
type VarTemplate struct {
Pieces []string // fixed pieces
Indices []int // arg indices for variables between pieces
Builder strings.Builder // builder for Expand functions
}
VarTemplate holds the pieces of the template in optimal format This is not safe for concurrent use!
func Parse ¶
func Parse(str string) *VarTemplate
Parse parses the given string to an efficient template
func (*VarTemplate) Expand ¶
func (t *VarTemplate) Expand(args []string) string
Expand constructs string with variables replaced with given arguments
Directories
¶
| Path | Synopsis |
|---|---|
|
Dummy test client for local testing
|
Dummy test client for local testing |
|
HTTP Client using the fasthttp library
|
HTTP Client using the fasthttp library |
|
HTTP Client using Go standard library
|
HTTP Client using Go standard library |
|
Simple fasthttp server for testing the HTTP client
|
Simple fasthttp server for testing the HTTP client |
|
SQL Client
|
SQL Client |