standalone

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package standalone provides infrastructures to write network simulations without simulating compute cores and memory systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	*sim.TickingComponent

	ToOut sim.Port

	Buffer []*TrafficMsg
}

Agent is a component that connects the network. It can send and receive msg to/ from the network.

func NewAgent

func NewAgent(name string, engine sim.Engine) *Agent

NewAgent creates a new agent.

func (*Agent) Handle

func (a *Agent) Handle(e sim.Event) error

Handle defines how an agent handles events.

func (*Agent) NotifyRecv

func (a *Agent) NotifyRecv(now sim.VTimeInSec, port sim.Port)

NotifyRecv notifies that a port has received a message.

func (*Agent) Tick

func (a *Agent) Tick(now sim.VTimeInSec) bool

Tick attempts to send a message out.

type GreedyTrafficInjector

type GreedyTrafficInjector struct {
	PacketSize int
	NumPackets int
	// contains filtered or unexported fields
}

GreedyTrafficInjector generate a large number of traffic at the beginning of the simulation.

func NewGreedyTrafficInjector

func NewGreedyTrafficInjector(engine sim.Engine) *GreedyTrafficInjector

NewGreedyTrafficInjector creates a new GreedyTrafficInjector.

func (*GreedyTrafficInjector) InjectTraffic

func (ti *GreedyTrafficInjector) InjectTraffic()

InjectTraffic injects traffic.

func (*GreedyTrafficInjector) RegisterAgent

func (ti *GreedyTrafficInjector) RegisterAgent(a *Agent)

RegisterAgent allows the GreedyTraffiCInjector to inject traffic from the agent.

type StartSendEvent

type StartSendEvent struct {
	*sim.EventBase
	Msg *TrafficMsg
}

StartSendEvent is an event that triggers an agent to send a message.

func NewStartSendEvent

func NewStartSendEvent(
	time sim.VTimeInSec,
	src, dst *Agent,
	byteSize int,
	trafficClass int,
) *StartSendEvent

NewStartSendEvent creates a new StartSendEvent.

type TrafficInjector

type TrafficInjector interface {
	RegisterAgent(a *Agent)
	InjectTraffic()
}

A TrafficInjector can inject traffic to a network.

type TrafficMsg

type TrafficMsg struct {
	sim.MsgMeta
}

TrafficMsg is a type of msg that only used in standalone network test. It has a byte size, but we do not care about the information it carries.

func NewTrafficMsg

func NewTrafficMsg(src, dst sim.Port, byteSize int) *TrafficMsg

NewTrafficMsg creates a new traffic message

func (*TrafficMsg) Meta

func (m *TrafficMsg) Meta() *sim.MsgMeta

Meta returns the meta data of the message.

Jump to

Keyboard shortcuts

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