monitoring

package
v4.0.0-...-c5efee1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package monitoring provides a solution that allows monitoring simulation externally.

Index

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 NewMonitor

func NewMonitor() *Monitor

NewMonitor creates a new Monitor

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

func (m *Monitor) RegisterComponent(c sim.Component)

RegisterComponent register a component to be monitored.

func (*Monitor) RegisterEngine

func (m *Monitor) RegisterEngine(e sim.Engine)

RegisterEngine registers the engine that is used in the simulation.

func (*Monitor) StartServer

func (m *Monitor) StartServer()

StartServer starts the monitor as a web server with a custom port if wanted.

func (*Monitor) WithPortNumber

func (m *Monitor) WithPortNumber(portNumber int) *Monitor

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.

Directories

Path Synopsis
Package web includes the static web pages for the monitoring tool.
Package web includes the static web pages for the monitoring tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL