Documentation ¶
Overview ¶
Package monitoring provides a solution that allows monitoring simulation externally.
Index ¶
- type Monitor
- func (m *Monitor) CompleteProgressBar(pb *ProgressBar)
- func (m *Monitor) CreateProgressBar(name string, total uint64) *ProgressBar
- func (m *Monitor) RegisterComponent(c sim.Component)
- func (m *Monitor) RegisterEngine(e sim.Engine)
- func (m *Monitor) RegisterPerfAnalyzer(pa *analysis.PerfAnalyzer)
- func (m *Monitor) StartServer()
- func (m *Monitor) WithPortNumber(portNumber int) *Monitor
- type ProgressBar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor can turn a simulation into a server and allows external monitoring controlling of the simulation.
func (*Monitor) CompleteProgressBar ¶
func (m *Monitor) CompleteProgressBar(pb *ProgressBar)
CompleteProgressBar removes a bar to be shown on the webpage.
func (*Monitor) CreateProgressBar ¶
func (m *Monitor) CreateProgressBar(name string, total uint64) *ProgressBar
CreateProgressBar creates a new progress bar.
func (*Monitor) RegisterComponent ¶
RegisterComponent register a component to be monitored.
func (*Monitor) RegisterEngine ¶
RegisterEngine registers the engine that is used in the simulation.
func (*Monitor) RegisterPerfAnalyzer ¶ added in v3.1.0
func (m *Monitor) RegisterPerfAnalyzer(pa *analysis.PerfAnalyzer)
RegisterPerfAnalyzer sets the performance analyzer to be used in the monitor.
func (*Monitor) StartServer ¶
func (m *Monitor) StartServer()
StartServer starts the monitor as a web server with a custom port if wanted.
func (*Monitor) WithPortNumber ¶
WithPortNumber sets the port number of the monitor.
type ProgressBar ¶
type ProgressBar struct { sync.Mutex ID string `json:"id"` Name string `json:"name"` StartTime time.Time `json:"start_time"` Total uint64 `json:"total"` Finished uint64 `json:"finished"` InProgress uint64 `json:"in_progress"` }
A ProgressBar is a tracker of the progress
func (*ProgressBar) IncrementFinished ¶
func (b *ProgressBar) IncrementFinished(amount uint64)
IncrementFinished add a certain amount to finished element.
func (*ProgressBar) IncrementInProgress ¶
func (b *ProgressBar) IncrementInProgress(amount uint64)
IncrementInProgress adds the number of in-progress element.
func (*ProgressBar) MoveInProgressToFinished ¶
func (b *ProgressBar) MoveInProgressToFinished(amount uint64)
MoveInProgressToFinished reduces the number of in progress item by a certain amount and increase the finished item by the same amount.