Documentation ¶
Overview ¶
Package plotting provides functions and structures for plotting measurement data collected from running an experiment.
Index ¶
- func CSVPlot(filename string, headers []string, plot func() plotter.XYer) error
- func GonumPlot(filename, xlabel, ylabel string, f func(plt *plot.Plot) error) error
- func TimeAndAverage(groups []MeasurementGroup, getValue func(Measurement) (float64, uint64)) plotter.XYer
- type ClientLatencyPlot
- type Measurement
- type MeasurementGroup
- type MeasurementMap
- type Plotter
- type Reader
- type StartTimes
- func (s *StartTimes) Add(msg any)
- func (s *StartTimes) Client(id uint32) (t time.Time, ok bool)
- func (s *StartTimes) ClientOffset(id uint32, t time.Time) (offset time.Duration, ok bool)
- func (s *StartTimes) Replica(id uint32) (t time.Time, ok bool)
- func (s *StartTimes) ReplicaOffset(id uint32, t time.Time) (offset time.Duration, ok bool)
- type ThroughputPlot
- type ThroughputVSLatencyPlot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TimeAndAverage ¶
func TimeAndAverage(groups []MeasurementGroup, getValue func(Measurement) (float64, uint64)) plotter.XYer
TimeAndAverage returns a struct that yields (x, y) points where x is the time, and y is the average value of each group. The getValue function must return the value and sample count for the given measurement.
Types ¶
type ClientLatencyPlot ¶
type ClientLatencyPlot struct {
// contains filtered or unexported fields
}
ClientLatencyPlot plots client latency measurements.
func NewClientLatencyPlot ¶
func NewClientLatencyPlot() ClientLatencyPlot
NewClientLatencyPlot returns a new client latency plotter.
func (*ClientLatencyPlot) Add ¶
func (p *ClientLatencyPlot) Add(measurement any)
Add adds a measurement to the plot.
func (*ClientLatencyPlot) PlotAverage ¶
func (p *ClientLatencyPlot) PlotAverage(filename string, measurementInterval time.Duration) (err error)
PlotAverage plots the average latency of all clients within each measurement interval.
type Measurement ¶
Measurement is an object with a types.Event getter.
type MeasurementGroup ¶
type MeasurementGroup struct { Time time.Duration // The beginning of the time interval Measurements []Measurement }
MeasurementGroup is a collection of measurements that were taken within a time interval.
func GroupByTimeInterval ¶
func GroupByTimeInterval(startTimes *StartTimes, m MeasurementMap, interval time.Duration) []MeasurementGroup
GroupByTimeInterval merges all measurements from all client/replica ids into groups based on the time interval that the measurement was taken in. The StartTimes object is used to calculate which time interval a measurement falls in.
type MeasurementMap ¶
type MeasurementMap struct {
// contains filtered or unexported fields
}
MeasurementMap is a map that stores lists Measurement objects associated with the ID of the client/replica where they where taken.
func NewMeasurementMap ¶
func NewMeasurementMap() MeasurementMap
NewMeasurementMap constructs a new MeasurementMap
func (*MeasurementMap) Add ¶
func (m *MeasurementMap) Add(id uint32, measurement Measurement)
Add adds a measurement to the map.
func (*MeasurementMap) Get ¶
func (m *MeasurementMap) Get(id uint32) (measurements []Measurement, ok bool)
Get returns the list of measurements associated with the specified client/replica id.
func (*MeasurementMap) NumIDs ¶
func (m *MeasurementMap) NumIDs() int
NumIDs returns the number of client/replica IDs that are registered in the map.
type Plotter ¶
type Plotter interface { // Adds a measurement to the plotter. Add(any) }
Plotter processes measurements from a reader.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads measurements from JSON.
type StartTimes ¶
type StartTimes struct {
// contains filtered or unexported fields
}
StartTimes collects the start times for each client or replica.
func NewStartTimes ¶
func NewStartTimes() StartTimes
NewStartTimes returns a new StartTimes instance.
func (*StartTimes) Client ¶
func (s *StartTimes) Client(id uint32) (t time.Time, ok bool)
Client returns the start time of the client with the specified id.
func (*StartTimes) ClientOffset ¶
ClientOffset returns the time offset from the client's start time.
func (*StartTimes) Replica ¶
func (s *StartTimes) Replica(id uint32) (t time.Time, ok bool)
Replica returns the start time of the replica with the specified id.
func (*StartTimes) ReplicaOffset ¶
ReplicaOffset returns the time offset from the replica's start time.
type ThroughputPlot ¶
type ThroughputPlot struct {
// contains filtered or unexported fields
}
ThroughputPlot is a plotter that plots throughput vs time.
func NewThroughputPlot ¶
func NewThroughputPlot() ThroughputPlot
NewThroughputPlot returns a new throughput plotter.
func (*ThroughputPlot) Add ¶
func (p *ThroughputPlot) Add(measurement any)
Add adds a measurement to the plotter.
func (*ThroughputPlot) PlotAverage ¶
func (p *ThroughputPlot) PlotAverage(filename string, measurementInterval time.Duration) (err error)
PlotAverage plots the average throughput of all replicas at specified time intervals.
type ThroughputVSLatencyPlot ¶
type ThroughputVSLatencyPlot struct {
// contains filtered or unexported fields
}
ThroughputVSLatencyPlot is a plotter that plots throughput vs time.
func NewThroughputVSLatencyPlot ¶
func NewThroughputVSLatencyPlot() ThroughputVSLatencyPlot
NewThroughputVSLatencyPlot returns a new throughput plotter.
func (*ThroughputVSLatencyPlot) Add ¶
func (p *ThroughputVSLatencyPlot) Add(measurement any)
Add adds a measurement to the plotter.
func (*ThroughputVSLatencyPlot) PlotAverage ¶
func (p *ThroughputVSLatencyPlot) PlotAverage(filename string, measurementInterval time.Duration) (err error)
PlotAverage plots the average throughput of all replicas at specified time intervals.