Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CombinedCounter ¶
type CombinedCounter struct {
// contains filtered or unexported fields
}
func CombineCounters ¶
func CombineCounters(interval time.Duration, counters ...Counter) *CombinedCounter
func (*CombinedCounter) CountAllNow ¶
func (c *CombinedCounter) CountAllNow()
func (*CombinedCounter) Start ¶
func (c *CombinedCounter) Start()
func (*CombinedCounter) Stop ¶
func (c *CombinedCounter) Stop()
type Counter ¶
type Counter interface {
CountNow() // CountNow forcibly make the counter take a measurement immediately and save it to the result
Start()
Stop()
Result() map[time.Time]any // Result values must be printable and/or JSON-serializable
}
func NewCpuUsageCounter ¶
func NewMemoryUsageCounter ¶
type CounterBase ¶
type CounterBase struct {
// contains filtered or unexported fields
}
CounterBase is an incomplete implementation of Counter.
func NewCounterBase ¶
func NewCounterBase(interval time.Duration) *CounterBase
NewCounterBase creates a new CounterBase and initializes its internal fields.
func (*CounterBase) Result ¶
func (c *CounterBase) Result() map[time.Time]any
Result returns the result of the counter.
It is recommended for Counter implementations to directly inherit this method.
func (*CounterBase) Start ¶
func (c *CounterBase) Start()
Start starts the ticker only. Implementation of Counter must listen for the ticker and the closed channel.
func (*CounterBase) Stop ¶
func (c *CounterBase) Stop()
Stop stops the ticker and closes the closed channel.
It is recommended for Counter implementations to directly inherit this method.
type CounterReport ¶
func NewCounterReport ¶
func NewCounterReport() CounterReport
type IntervalBenchmark ¶
type IntervalBenchmark struct {
MessageSize int `json:"message_size" yaml:"message_size"` // MessageSize defines how many bytes to write for each send attempt
TotalMessages uint64 `json:"total_messages" yaml:"total_messages"` // TotalMessages defines how many messages to send in total
Interval time.Duration `json:"interval" yaml:"interval"` // Interval defines how long to wait between each send attempt. If this value is too low, it is possible that the actual interval will be much higher due to system limitations
Echo bool `json:"echo" yaml:"echo"` // Echo defines whether the receiver should echo back the received message
// contains filtered or unexported fields
}
IntervalBenchmark is a benchmark that sends a fixed number of messages of a fixed size one after another with a fixed interval between each send attempt and measures the throughput and latency.
func (*IntervalBenchmark) Reader ¶
func (b *IntervalBenchmark) Reader(conn net.Conn, counters ...Counter) error
func (*IntervalBenchmark) Result ¶
func (b *IntervalBenchmark) Result() map[string]any
type PressuredBenchmark ¶
type PressuredBenchmark struct {
MessageSize int `json:"message_size" yaml:"message_size"` // MessageSize defines how many bytes to write for each send attempt
TotalMessages uint64 `json:"total_messages" yaml:"total_messages"` // TotalMessages defines how many messages to send in total
// contains filtered or unexported fields
}
PressuredBenchmark is a benchmark that sends a fixed number of messages of a fixed size one after another as fast as possible and measures the throughput and latency.
func (*PressuredBenchmark) Reader ¶
func (b *PressuredBenchmark) Reader(conn net.Conn, counters ...Counter) error
func (*PressuredBenchmark) Result ¶
func (b *PressuredBenchmark) Result() map[string]any