Documentation ¶
Index ¶
- Variables
- func BuildExperimentCP(syn map[string]string, useYAML bool, idCounter int, tm TraceManager) (*evtm.EventManager, error)
- func CheckDirectories(dirs []string) (bool, error)
- func CheckFiles(names []string, checkExistence bool) (bool, error)
- func CheckOutputFiles(names []string) (bool, error)
- func CheckReadableFiles(names []string) (bool, error)
- func ClassCreateConnSrcCfg() *connSrcCfg
- func ClassCreateCycleDstCfg() *cycleDstCfg
- func ClassCreateFinishCfg() *finishCfg
- func ClassCreateProcessPcktCfg() *processPcktCfg
- func CmpPtnFuncHost(cpfi *CmpPtnFuncInst) string
- func CmpPtnFuncInstHost(cpfi *CmpPtnFuncInst) string
- func CreateClassMethods() bool
- func EmptyInitFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any
- func EndRecExec(execID int, time float64) float64
- func EnterFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any
- func ExitFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any
- func FuncExecTime(cpfi *CmpPtnFuncInst, op string, msg *CmpPtnMsg) float64
- func GetExperimentCPDicts(syn map[string]string) (*CompPatternDict, *CPInitListDict, *SharedCfgGroupList, *FuncExecList, ...)
- func LostCmpPtnMsg(evtMgr *evtm.EventManager, context any, msg any) any
- func ReEnter(evtMgr *evtm.EventManager, cpFunc any, rtnmsg any) any
- func RegisterFuncClass(fc FuncClassCfg) bool
- func ReportErrs(errs []error) error
- func ReportStatistics()
- func SecondsToTime(sec float64) vrtime.Time
- func UpdateMsg(msg *CmpPtnMsg, nxtCPID int, nxtLabel, msgType, nxtMC string)
- type AlgSpec
- type CPInitList
- type CPInitListDict
- type CmpPtnFuncInst
- func (cpfi *CmpPtnFuncInst) AddEndMethod(methodCode string, end evtm.EventHandlerFunction) bool
- func (cpfi *CmpPtnFuncInst) AddResponse(execID int, resp []*CmpPtnMsg)
- func (cpfi *CmpPtnFuncInst) AddStartMethod(methodCode string, start StartMethod) bool
- func (cpfi *CmpPtnFuncInst) GlobalName() string
- func (cpfi *CmpPtnFuncInst) InitMsgParams(msgType string, msgLen, pcktLen int, rate float64)
- type CmpPtnGraph
- type CmpPtnGraphEdge
- type CmpPtnGraphNode
- type CmpPtnInst
- type CmpPtnMsg
- type CompPattern
- func (cpt *CompPattern) AddEdge(srcFuncLabel, dstFuncLabel string, msgType string, methodCode string, ...)
- func (cpt *CompPattern) AddExtEdge(srcCP, dstCP, srcLabel, dstLabel string, msgType string, methodCode string, ...)
- func (cpt *CompPattern) AddFunc(fs *Func)
- func (cp *CompPattern) DeepCopy() *CompPattern
- func (cpt *CompPattern) SetName(name string)
- type CompPatternDict
- type CompPatternMap
- type CompPatternMapDict
- type CompPatternMsg
- type CryptoDesc
- type EndPtFuncs
- type ExtCmpPtnGraphEdge
- type Func
- type FuncClassCfg
- type FuncExecDesc
- type FuncExecList
- type GlobalFuncID
- type InEdge
- type NetSimPortal
- type OutEdge
- type RespMethod
- type SharedCfgGroup
- type SharedCfgGroupList
- type StartMethod
- type TraceManager
- type XCPEdge
Constants ¶
This section is empty.
Variables ¶
var ClassMethods map[string]map[string]RespMethod = make(map[string]map[string]RespMethod)
ClassMethods maps the function class name to a map indexed by (string) operation code to get to a pair of functions to handle the entry and exit to the function
var ClassMethodsBuilt bool = CreateClassMethods()
var CmpPtnInstByID map[int]*CmpPtnInst = make(map[int]*CmpPtnInst)
var CmpPtnInstByName map[string]*CmpPtnInst = make(map[string]*CmpPtnInst)
CmpPtnInstByName and CmpPtnInstByID take the the name (alt., id) of an instance of a CompPattern, and associate a pointer to its struct
var FuncClassNames map[string]bool = map[string]bool{"connSrc": true, "processPckt": true, "cryptoPckt": true, "cycleDst": true, "finish": true}
FuncClassNames needs to have an indexing key for every class of function that might be included in a model.
var FuncClasses map[string]FuncClassCfg = make(map[string]FuncClassCfg)
FuncClasses is a map that takes us from the name of a FuncClass
var NumIDs int = 0
NumIDs holds value that utility function used for generating unique integer ids on demand
Functions ¶
func BuildExperimentCP ¶
func BuildExperimentCP(syn map[string]string, useYAML bool, idCounter int, tm TraceManager) (*evtm.EventManager, error)
BuildExperimentCP is called from the module that creates and runs a simulation. Its inputs identify the names of input files, which it uses to assemble and initialize the model (and experiment) data structures. It returns a pointer to an EventManager data structure used to coordinate the execution of events in the simulation.
func CheckDirectories ¶
CheckDirectories probes the file system for the existence of every directory listed in the list of files. Returns a boolean indicating whether all dirs are valid, and returns an aggregated error if any checks failed.
func CheckFiles ¶
CheckFiles probes the file system for permitted access to all the argument filenames, optionally checking also for the existence of those files for the purposes of reading them.
func CheckOutputFiles ¶
CheckOutputFiles probles the file system to ensure that every argument filename can be written.
func CheckReadableFiles ¶
CheckReadableFiles probles the file system to ensure that every one of the argument filenames exists and is readable
func ClassCreateConnSrcCfg ¶ added in v0.0.5
func ClassCreateConnSrcCfg() *connSrcCfg
func ClassCreateCycleDstCfg ¶ added in v0.0.5
func ClassCreateCycleDstCfg() *cycleDstCfg
func ClassCreateFinishCfg ¶ added in v0.0.5
func ClassCreateFinishCfg() *finishCfg
func ClassCreateProcessPcktCfg ¶ added in v0.0.5
func ClassCreateProcessPcktCfg() *processPcktCfg
ClassCreateProcessPckt is a constructor called just to create an instance, fields unimportant
func CmpPtnFuncHost ¶
func CmpPtnFuncHost(cpfi *CmpPtnFuncInst) string
func CmpPtnFuncInstHost ¶
func CmpPtnFuncInstHost(cpfi *CmpPtnFuncInst) string
CmpPtnFuncInstHost returns the name of the host to which the CmpPtnFuncInst given as argument is mapped.
func CreateClassMethods ¶
func CreateClassMethods() bool
func EmptyInitFunc ¶
func EmptyInitFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any
EmptyInitFunc exists to detect when there is actually an initialization event handler (by having a 'emptyInitFunc' below be re-written to point to something else
func EndRecExec ¶
EndRecExec computes the completed execution time of the execution identified, given the ending time, incorporates its statistics into the CmpPtnInst statistics summary
func EnterFunc ¶
func EnterFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any
EnterFunc is an event-handling routine, scheduled by an evtm.EventManager to execute and simulate the results of a message arrival to a CmpPtnInst function. The particular CmpPtnInst and particular message are given as arguments to the function. A type-unspecified return is provided.
func ExitFunc ¶
func ExitFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any
ExitFunc is an event handling routine that implements the scheduling of messages which result from the completed (simulated) execution of a CmpPtnFuncInst. The CmpPtnFuncInst and the message that triggered the execution are given as arguments to ExitFunc. This routine calls the CmpPtnFuncInst's function that computes the effect of doing the simulation, a routine which (by the CmpPtnFuncInst interface definition) returns a slice of CmpPtnMsgs which are then pushed further along the CompPattern chain.
func FuncExecTime ¶
func FuncExecTime(cpfi *CmpPtnFuncInst, op string, msg *CmpPtnMsg) float64
FuncExecTime returns the increase in execution time resulting from executing the CmpPtnFuncInst offered as argument, to the message also offered as argument. If the pcktlen of the message does not exactly match the pcktlen parameter of a func timing entry, an interpolation or extrapolation of existing entries is performed.
func GetExperimentCPDicts ¶
func GetExperimentCPDicts(syn map[string]string) (*CompPatternDict, *CPInitListDict, *SharedCfgGroupList, *FuncExecList, *CompPatternMapDict)
GetExperimentCPDicts accepts a map that holds the names of the input files used to define an experiment, creates internal representations of the information they hold, and returns those structs.
func LostCmpPtnMsg ¶
func LostCmpPtnMsg(evtMgr *evtm.EventManager, context any, msg any) any
LostCmpPtnMsg is scheduled from the mrnes side to report the loss of a comp pattern message
func RegisterFuncClass ¶
func RegisterFuncClass(fc FuncClassCfg) bool
RegisterFuncClass is called to tell the system that a particular function class exists, and gives a point to its description. The idea is to register only those function classes actually used, or at least, provide clear separation between classes. Reflect of bool allows call to RegisterFuncClass as part of a variable assignment outside of a function body
func ReportErrs ¶
ReportErrs transforms a list of errors and transforms the non-nil ones into a single error with comma-separated report of all the constituent errors, and returns it.
func ReportStatistics ¶
func ReportStatistics()
func SecondsToTime ¶ added in v0.0.11
Types ¶
type AlgSpec ¶
type AlgSpec struct { Name string // e.g., 'aes','des' KeyLen []int // lengths of keys used in measurements represented in the functional timings }
AlgSpec provides representation of crypto algorithm and key lengths for which we have timing measurements. Used in the CryptoDesc struct below, which can be read by a GUI to align with the crypto algorithms and key lengths that are available
type CPInitList ¶
type CPInitList struct { // name of the Computation Pattern whose Funcs are being initialized Name string `json:"name" yaml:"name"` // CPType of CP being initialized CPType string `json:"cptype" yaml:"cptype"` // UseYAML flags whether to interpret the seriaized initialization structure using json or yaml UseYAML bool `json:"useyaml" yaml:"useyaml"` // Cfg is indexed by Func label, mapping to a serialized representation of a struct Cfg map[string]string `json:"cfg" yaml:"cfg"` // Msgs holds a list of CompPatternMsgs used between Funcs in a CompPattern Msgs []CompPatternMsg `json:"msgs" yaml:"msgs"` }
CPInitList describes configuration parameters for the Funcs of a CompPattern
func CreateCPInitList ¶
func CreateCPInitList(name string, cptype string, useYAML bool) *CPInitList
CreateCPInitList constructs a CPInitList for an instance of a CompPattern and initializes it with a name and flag indicating whether YAML is used
func ReadCPInitList ¶
func ReadCPInitList(filename string, useYAML bool, dict []byte) (*CPInitList, error)
ReadCPInitList returns a deserialized slice of bytes into a CPInitList. Bytes are either provided, or are read from a file whose name is given.
func (*CPInitList) AddCfg ¶ added in v0.0.5
func (cpil *CPInitList) AddCfg(cp *CompPattern, fnc *Func, cfg string)
AddCfg puts a serialized initialization struct in the dictionary indexed by Func label
func (*CPInitList) AddMsg ¶
func (cpil *CPInitList) AddMsg(msg *CompPatternMsg) error
AddMsg appends description of a ComPatternMsg to the CPInitList's slice of messages used by the CompPattern. An error is returned if the msg's type already exists in the Msgs list
func (*CPInitList) DeepCopy ¶
func (cpil *CPInitList) DeepCopy() *CPInitList
DeepCopy creates a copy of CPInitList that explicitly copies various complex data structures
func (*CPInitList) WriteToFile ¶
func (cpil *CPInitList) WriteToFile(filename string) error
WriteToFile serializes the CPInitList and writes it to a file. Output file extension identifies whether serialization is to json or to yaml
type CPInitListDict ¶
type CPInitListDict struct { DictName string `json:"dictname" yaml:"dictname"` // indexed by name of comp pattern InitList map[string]CPInitList `json:"initlist" yaml:"initlist"` }
CPInitListDict holds CPInitList structures in a dictionary that may hold prebuilt versions (in which case InitList is indexed by CompPattern type) or is holding init lists for CPs to be part of an experiment, so the CP name is known is used as the key
func CreateCPInitListDict ¶
func CreateCPInitListDict(name string) *CPInitListDict
CreateCPInitListDict is an initialization constructor. Its output struct has methods for integrating data.
func ReadCPInitListDict ¶
func ReadCPInitListDict(filename string, useYAML bool, dict []byte) (*CPInitListDict, error)
ReadCPInitListDict deserializes a slice of bytes and returns a CPInitListDict. Bytes are either provided, or are read from a file whose name is given.
func (*CPInitListDict) AddCPInitList ¶
func (cpild *CPInitListDict) AddCPInitList(cpil *CPInitList) error
AddCPInitList puts a CPInitList into the dictionary
func (*CPInitListDict) RecoverCPInitList ¶
func (cpild *CPInitListDict) RecoverCPInitList(cptype string, cpname string) (*CPInitList, bool)
RecoverCPInitList returns a copy of a CPInitList from the dictionary
func (*CPInitListDict) WriteToFile ¶
func (cpild *CPInitListDict) WriteToFile(filename string) error
WriteToFile serializes the CPInitListDict and writes it to a file. Output file extension identifies whether serialization is to json or to yaml
type CmpPtnFuncInst ¶
type CmpPtnFuncInst struct { InitFunc evtm.EventHandlerFunction // if not 'emptyInitFunc' call this to initialize the function AuxFunc evtm.EventHandlerFunction InitMsg *CmpPtnMsg // message that is copied when this instance is used to initiate a chain of func evaluations Class string // specifier leading to specific state, entrance, and exit functions Label string // an identifier for this func, unique within the instance of CompPattern holding it. Host string // identity of the host to which this func is mapped for execution PtnName string // name of the instantiated CompPattern holding this function CPID int // id of the comp pattern this func is attached to ID int // integer identity which is unique among all objects in the pces model Active bool // flag whether function is actively processing inputs Trace bool // indicate whether this function should record its enter/exit in the trace Cfg any // holds string-coded state for string-code configuratin variable names State any // holds string-coded state for string-code state variable names InterarrivalDist string InterarrivalMean float64 // represent the comp pattern edges touching this function. The in edge // is indexed by the source function label and message type, yielding the method code InEdgeMethodCode map[edgeStruct]string // the out edges are in a list of edgeStructs OutEdges []edgeStruct // respMethods indexed by method code RespMethods map[string]*RespMethod // save messages created as result of processing function MsgResp map[int][]*CmpPtnMsg }
The CmpPtnFuncInst struct represents an instantiated instance of a function
func (*CmpPtnFuncInst) AddEndMethod ¶
func (cpfi *CmpPtnFuncInst) AddEndMethod(methodCode string, end evtm.EventHandlerFunction) bool
AddEndMethod includes a customized End method to a previously defined respMethod
func (*CmpPtnFuncInst) AddResponse ¶
func (cpfi *CmpPtnFuncInst) AddResponse(execID int, resp []*CmpPtnMsg)
AddResponse stores the selected out message response from executing the function, to be released later. Saving through cpfi.Resp[execID] to account for concurrent overlapping executions
func (*CmpPtnFuncInst) AddStartMethod ¶
func (cpfi *CmpPtnFuncInst) AddStartMethod(methodCode string, start StartMethod) bool
AddStartMethod associates a string response 'name' with a pair of methods used to represent the start and end of the function's execution. The default method for the end method is ExitFunc Return of bool allows call to RegisterFuncClass as part of a variable assignment outside of a function body
func (*CmpPtnFuncInst) GlobalName ¶
func (cpfi *CmpPtnFuncInst) GlobalName() string
func (*CmpPtnFuncInst) InitMsgParams ¶
func (cpfi *CmpPtnFuncInst) InitMsgParams(msgType string, msgLen, pcktLen int, rate float64)
type CmpPtnGraph ¶
type CmpPtnGraph struct { // every instance a function has a string 'label', used here to index to // data structure that describes it and the connections it has with other funcs Nodes map[string]*CmpPtnGraphNode }
A CmpPtnGraph is the run-time description of a CompPattern
type CmpPtnGraphEdge ¶
CmpPtnGraphEdge declares the possibility that a function with label srcLabel might send a message of type msgType to the function (in the same CPG) with label dstLabel
func CreateCmpPtnGraphEdge ¶
func CreateCmpPtnGraphEdge(srcLabel, msgType, dstLabel, methodCode string) *CmpPtnGraphEdge
func (*CmpPtnGraphEdge) EdgeStr ¶
func (cpge *CmpPtnGraphEdge) EdgeStr() string
type CmpPtnGraphNode ¶
type CmpPtnGraphNode struct { Label string InEdges []*CmpPtnGraphEdge OutEdges []*CmpPtnGraphEdge }
A CmpPtnGraphNode names a function with its label, and describes the edges for which it is a destination (inEdges) and edges for which it is a source (outEdges)
type CmpPtnInst ¶
type CmpPtnInst struct { Name string // this instance's particular name CpType string ID int // unique id Funcs map[string]*CmpPtnFuncInst // use func label to get to func in that pattern with that label Msgs map[string]CompPatternMsg // MsgType indexes msgs Rngs *rngstream.RngStream Graph *CmpPtnGraph // graph describing structure of funcs and edges Active map[int]execRecord // executions that are active now ActiveCnt map[int]int // number of instances of executions with common execID (>1 by branching) LostExec map[int]evtm.EventHandlerFunction // call this handler when a packet for a given execID is lost Finished map[string]execSummary // summary of completed executions }
CmpPtnInst describes a particular instance of a CompPattern, built from information read in from CompPatternDesc struct and used at runtime
func (*CmpPtnInst) ExecReport ¶
func (cpi *CmpPtnInst) ExecReport() []float64
ExecReport reports delay times of completed cmpPtnInst executions
type CmpPtnMsg ¶
type CmpPtnMsg struct { ExecID int // initialize when with an initating comp pattern message. Carried by every resulting message. PrevCPID int // ID of the comp pattern through which the message most recently passed PrevLabel string // label of the func through which the message most recently passed NxtCPID int // integer ID of the next CP the message next visits NxtLabel string // string label of the function the message next visits NxtMC string // when non-empty, the method code at the function the message next visits CmpHdr EndPtFuncs MsgType string // describes function of message MsgLen int // number of bytes PcktLen int // parameter impacting execution time Rate float64 // when non-zero, a rate limiting attribute that might used, e.g., in modeling IO FlowState string // "srt", "end", "chg" Start bool // start the timer StartTime float64 // when the timer started NetLatency float64 NetBndwdth float64 NetPrLoss float64 Payload any // free for "something else" to carry along and be used in decision logic }
A CmpPtnMsg struct describes a message going from one CompPattern function to another. It carries ancillary information about the message that is included for referencing.
func (*CmpPtnMsg) CarriesPckt ¶ added in v0.0.6
CarriesPckt indicates whether the message conveys information about a packet or a flow
type CompPattern ¶
type CompPattern struct { // a model may use a number of instances of CompPatterns that have the same CPType CPType string `json:"cptype" yaml:"cptype"` // per-instance name of the pattern template Name string `json:"name" yaml:"name"` // instances of functions indexed by unique-to-pattern label Funcs []Func `json:"funcs" yaml:"funcs"` // description of edges in Pattern graph Edges []CmpPtnGraphEdge `json:"edges" yaml:"edges"` // description of external edges in Pattern graph ExtEdges map[string][]XCPEdge `json:"extedges" yaml:"extedges"` }
CompPattern is a directed graph that describes the data flow among functions that implement an end-to-end computation
func CreateCompPattern ¶
func CreateCompPattern(cmptnType string) *CompPattern
CreateCompPattern is an initialization constructor. Its output struct has methods for integrating data.
func (*CompPattern) AddEdge ¶
func (cpt *CompPattern) AddEdge(srcFuncLabel, dstFuncLabel string, msgType string, methodCode string, msgs *[]CompPatternMsg)
AddEdge creates an edge that describes message flow from one Func to another in the same comp pattern and adds it to the CompPattern's list of edges. Called from code that is building a model, applies some sanity checking
func (*CompPattern) AddExtEdge ¶
func (cpt *CompPattern) AddExtEdge(srcCP, dstCP, srcLabel, dstLabel string, msgType string, methodCode string, srcMsgs *[]CompPatternMsg, dstMsgs *[]CompPatternMsg)
AddExtEdge creates an edge that describes message flow from one Func to another in a different computational pattern and adds it to the CompPattern's list of external edges. Perform some sanity checks before commiting the edge
func (*CompPattern) AddFunc ¶
func (cpt *CompPattern) AddFunc(fs *Func)
AddFunc includes a function specification to a CompPattern
func (*CompPattern) DeepCopy ¶
func (cp *CompPattern) DeepCopy() *CompPattern
DeepCopy creates a copy of CompPattern that explicitly copies various complex data structures
func (*CompPattern) SetName ¶
func (cpt *CompPattern) SetName(name string)
SetName copies the given name to be the CmpPtn's attribute and saves the name -> CmpPtn mapping in cmptnByName
type CompPatternDict ¶
type CompPatternDict struct { DictName string `json:"dictname" yaml:"dictname"` Patterns map[string]CompPattern `json:"patterns" yaml:"patterns"` }
CompPatternDict holds pattern descriptions, is serializable
func CreateCompPatternDict ¶
func CreateCompPatternDict(name string) *CompPatternDict
CreateCompPatternDict is an initialization constructor. Its output struct has methods for integrating data.
func ReadCompPatternDict ¶
func ReadCompPatternDict(filename string, useYAML bool, dict []byte) (*CompPatternDict, error)
ReadCompPatternDict returns the transformation of a slice of bytes into a CompPatternDict, reading these from file if necessary.
func (*CompPatternDict) AddCompPattern ¶
func (cpd *CompPatternDict) AddCompPattern(ptn *CompPattern) error
AddCompPattern amends a CompPattern dictionary with another CompPattern. The prb flag indicates this is saved to a 'pre-built' dictionary from which selected CompPatterns are recovered when building a model. CP names are not created until build time, so the key used to read/write a CompPattern from the Patterns dictionary is the CompPattern cptype when accessing a prb dictionary, and the name otherwise so the CP type is used as a key when true, otherwise the CP name is known and used. If requested, and error is returned if the comp pattern being added is a duplicate.
func (*CompPatternDict) RecoverCompPattern ¶
func (cpd *CompPatternDict) RecoverCompPattern(cptype string, cpname string) (*CompPattern, bool)
RecoverCompPattern returns a copy of a CompPattern from the dictionary, indexing by type, and applying a name
func (*CompPatternDict) WriteToFile ¶
func (cpd *CompPatternDict) WriteToFile(filename string) error
WriteToFile serializes the comp pattern, and saves to the named file. Output file extension determines whether serialization is to json or yaml
type CompPatternMap ¶
type CompPatternMap struct { // PatternName identifies the name of the pattern instantiation being mapped PatternName string `json:"patternname" yaml:"patternname"` // mapping of func labels to hosts. Key is Label attribute of Func FuncMap map[string]string `json:"funcmap" yaml:"funcmap"` }
A CompPatternMap describes how funcs in an instantiated CompPattern are mapped to hosts
func CreateCompPatternMap ¶
func CreateCompPatternMap(ptnName string) *CompPatternMap
CreateCompPatternMap is a constructor.
func ReadCompPatternMap ¶
func ReadCompPatternMap(filename string, useYAML bool, dict []byte) (*CompPatternMap, error)
ReadCompPatternMap deserializes a byte slice holding a representation of an CompPatternMap struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.
func (*CompPatternMap) AddMapping ¶
func (cpm *CompPatternMap) AddMapping(funcLabel string, hostname string, overwrite bool) error
AddMapping inserts into the CompPatternMap a binding of Func label to a host. Optionally, an error might be returned if a binding of that Func has already been made, and is different.
func (*CompPatternMap) WriteToFile ¶
func (cpm *CompPatternMap) WriteToFile(filename string) error
WriteToFile stores the CompPatternMap struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.
type CompPatternMapDict ¶
type CompPatternMapDict struct { DictName string `json:"dictname" yaml:"dictname"` Map map[string]CompPatternMap `json:"map" yaml:"map"` }
A CompPatternMapDict holds copies of CompPatternMap structs in a map that is indexed by the PatternName of resident CompPatternMaps
var CmpPtnMapDict *CompPatternMapDict
func CreateCompPatternMapDict ¶
func CreateCompPatternMapDict(name string) *CompPatternMapDict
CreateCompPatternMapDict is a constructor. Saves the dictionary name and initializes the map of CompPatternMaps to-be-stored.
func ReadCompPatternMapDict ¶
func ReadCompPatternMapDict(filename string, useYAML bool, dict []byte) (*CompPatternMapDict, error)
ReadCompPatternMapDict deserializes a byte slice holding a representation of an CompPatternMapDict struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.
func (*CompPatternMapDict) AddCompPatternMap ¶
func (cpmd *CompPatternMapDict) AddCompPatternMap(cpm *CompPatternMap, overwrite bool) error
AddCompPatternMap includes in the dictionary a CompPatternMap that is provided as input. Optionally an error may be returned if an entry for the associated CompPattern exists already.
func (*CompPatternMapDict) RecoverCompPatternMap ¶
func (cpmd *CompPatternMapDict) RecoverCompPatternMap(pattern string) (*CompPatternMap, bool)
RecoverCompPatternMap returns a CompPatternMap associated with the CompPattern named in the input parameters. It returns also a flag denoting whether the identified CompPattern has an entry in the dictionary.
func (*CompPatternMapDict) WriteToFile ¶
func (cpmd *CompPatternMapDict) WriteToFile(filename string) error
WriteToFile stores the CompPatternMapDict struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.
type CompPatternMsg ¶
type CompPatternMsg struct { // edges in the CompPattern graph are labeled with MsgType, which means that a message across the edge must match in this attribute MsgType string `json:"msgtype" yaml:"msgtype"` // a message may be a packet or a flow IsPckt bool `json:"ispckt" yaml:"ispckt"` }
CompPatternMsg defines the structure of identification of messages that pass between Funcs in a CompPattern. Structures of this sort are transformed by a simulation run into a form that include experiment-defined payloads, and so representation of payload is absent here,
func CreateCompPatternMsg ¶
func CreateCompPatternMsg(msgType string, isPckt bool) *CompPatternMsg
CreateCompPatternMsg is a constructer.
type CryptoDesc ¶
type CryptoDesc struct {
Algs []AlgSpec
}
CryptoDesc is a structure used so that the GUI and simulator can 'see' the same set of crypto algorithms that might be chosen, and have their performance included in the system behavior
func BuildCryptoDesc ¶
func BuildCryptoDesc(filename string) *CryptoDesc
BuildCryptoDesc scans a given file of timing descriptions, looking for those with a Param == "KeyLength=integer" which are taken to be crypto algortithms and the Param a string-encoded integer description of the key length version
func ReadCryptoDesc ¶
func ReadCryptoDesc(filename string, useYAML bool, dict []byte) (*CryptoDesc, error)
ReadCryptoDesc deserializes a byte slice holding a representation of an CryptoDesc struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.
func (*CryptoDesc) WriteToFile ¶
func (cd *CryptoDesc) WriteToFile(filename string) error
WriteToFile stores the CryptoDesc struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.
type EndPtFuncs ¶ added in v0.0.5
EndPtFuncs carries information on a CmpPtnMsg about where the execution thread started, and where it ultimately is headed
type ExtCmpPtnGraphEdge ¶
type ExtCmpPtnGraphEdge struct { SrcCP string DstCP string CPGE CmpPtnGraphEdge }
type Func ¶
type Func struct { // identifies function, e.g., encryptRSA, used to look up execution time Class string `json:"class" yaml:"class"` // particular name given to function instance within a CompPattern Label string `json:"label" yaml:"label"` }
A Func represents a function used within a CompPattern. Its 'Label' attribute is an identifier for an instance of the Func that is unique among all Funcs that make up a CompPattern which uses it, and the Class attribute is an identifier used when Func describes are stored in a dictionary before being copied and assembled as part of CompPattern construction. Class typically describes the computation the Func represents.
func CreateFunc ¶
CreateFunc is a constructor for a Func. All parameters are given:
- Class, a string identifying what instances of this Func do. Like a variable type.
- FuncLabel, a unique identifier (within an instance of a CompPattern) of an instance of this Func
type FuncClassCfg ¶ added in v0.0.5
type FuncClassCfg interface { FuncClassName() string CreateCfg(string, bool) any InitCfg(*CmpPtnFuncInst, string, bool) ValidateCfg(*CmpPtnFuncInst) error }
A FuncClass represents the methods used to simulate the effect of executing a function, different types of input generate different types of responses, so we use a map whose key selects the start, end pair of methods
type FuncExecDesc ¶
type FuncExecDesc struct { Identifier string `json:"identifier" yaml:"identifier"` Param string `json:"param" yaml:"param"` CPUModel string `json:"CPUModel" yaml:"CPUModel"` PcktLen int `json:"pcktlen" yaml:"pcktlen"` ExecTime float64 `json:"exectime" yaml:"exectime"` }
A FuncExecDesc struct holds a description of a function timing. ExecTime is the time (in seconds), attributes it depends on are
Identifier - a unique name for this func call Param - additional information, e.g., key length for crypto CPUModel - the CPU, PcktLen - number of bytes in data packet being operated on
type FuncExecList ¶
type FuncExecList struct { // ListName is an identifier for this collection of timings ListName string `json:"listname" yaml:"listname"` // Times key is an identifier for the function. // Value is list of function times for that type of function Times map[string][]FuncExecDesc `json:"times" yaml:"times"` }
A FuncExecList holds a map (Times) whose key is the class of a Func, and whose value is a list of FuncExecDescs associated with all Funcs of that class
func CreateFuncExecList ¶
func CreateFuncExecList(listname string) *FuncExecList
CreateFuncExecList is an initialization constructor. Its output struct has methods for integrating data.
func ReadFuncExecList ¶
func ReadFuncExecList(filename string, useYAML bool, dict []byte) (*FuncExecList, error)
ReadFuncExecList deserializes a byte slice holding a representation of an FuncExecList struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.
func (*FuncExecList) AddTiming ¶
func (fel *FuncExecList) AddTiming(identifier, param, cpumodel string, pcktLen int, execTime float64)
AddTiming takes the parameters of a FuncExecDesc, creates one, and adds it to the FuncExecList
func (*FuncExecList) WriteToFile ¶
func (fel *FuncExecList) WriteToFile(filename string) error
WriteToFile stores the FuncExecList struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.
type GlobalFuncID ¶ added in v0.0.5
GlobalFuncID is a global identifier for a function, naming the CmpPtn that holds it and its label within that CmpPtn
type InEdge ¶
type InEdge struct { SrcLabel string `json:"srclabel" yaml:"srclabel"` MsgType string `json:"msgtype" yaml:"msgtype"` MethodCode string `json:"methodcode" yaml:"methodcode"` }
An InEdge describes the source Func of an incoming edge, the type of message it carries, and the method code flagging what code should execute as a result
type NetSimPortal ¶
type NetSimPortal interface { HostCPU(string) string EnterNetwork(*evtm.EventManager, string, string, int, int, float64, any, any, evtm.EventHandlerFunction, any, evtm.EventHandlerFunction) any }
NetSimPortal provides an interface to network simulator in the mrnes package. mrnes does not import pces (to avoid circular imports). However, code in pces can call a function in mrnes that returns a pointer to a structure that satisfies the NetSimPortal interface.
type OutEdge ¶
type OutEdge struct { MsgType string `json:"msgtype" yaml:"msgtype"` DstLabel string `json:"dstlabel" yaml:"dstlabel"` }
An OutEdge describes the destination Func of an outbound edge, and the type of message it carries.
type RespMethod ¶
type RespMethod struct { Start StartMethod End evtm.EventHandlerFunction }
RespMethod associates two RespFunc that implement a function's response, one when it starts, the other when it ends
type SharedCfgGroup ¶ added in v0.0.5
type SharedCfgGroup struct {}
SharedCfgGroup gathers descriptions of functions that share the same cfg information, even across CmpPtn boundaries
func CreateSharedCfgGroup ¶ added in v0.0.5
func CreateSharedCfgGroup(name string, class string) *SharedCfgGroup
CreateSharedCfgGroup is a constructor
func (*SharedCfgGroup) AddCfg ¶ added in v0.0.5
func (ssg *SharedCfgGroup) AddCfg(cfgStr string)
AddCfg gives a shared cfg group a serialized common cfg
func (*SharedCfgGroup) AddInstance ¶ added in v0.0.5
func (ssg *SharedCfgGroup) AddInstance(cmpPtnName, label string)
AddInstance appends a global function description to a shared cfg group, but makes sure that it does not exist already in that group
type SharedCfgGroupList ¶ added in v0.0.5
type SharedCfgGroupList struct { // UseYAML flags whether to interpret the seriaized cfg using json or yaml }
SharedCfgGroupList holds all the shared cfg groups defined, for inclusion in a shared cfg description file
func CreateSharedCfgGroupList ¶ added in v0.0.5
func CreateSharedCfgGroupList(yaml bool) *SharedCfgGroupList
CreateSharedCfgGroupList is a constructor
func ReadSharedCfgGroupList ¶ added in v0.0.5
func ReadSharedCfgGroupList(filename string, useYAML bool, dict []byte) (*SharedCfgGroupList, error)
ReadSharedCfgGroupList returns a deserialized slice of bytes into a SharedCfgGroupList. Bytes are either provided, or are read from a file whose name is given.
func (*SharedCfgGroupList) AddSharedCfgGroup ¶ added in v0.0.5
func (scgl *SharedCfgGroupList) AddSharedCfgGroup(ssg *SharedCfgGroup)
AddSharedCfgGroup includes an offered cfg group the the list, but checks that there is not already one there with the same name and class
func (*SharedCfgGroupList) WriteToFile ¶ added in v0.0.5
func (scgl *SharedCfgGroupList) WriteToFile(filename string) error
WriteToFile serializes the SharedCfgGroupList and writes it to a file. Output file extension identifies whether serialization is to json or to yaml
type StartMethod ¶
type StartMethod func(*evtm.EventManager, *CmpPtnFuncInst, string, *CmpPtnMsg)
StartMethod gives the signature of functions called to implement a function's entry point
type TraceManager ¶
type TraceManager interface { // at creation a flag is set indicating whether the trace manager will be active Active() bool // add a trace event to the manager AddTrace(vrtime.Time, int, int, int, string, bool, float64) // include an id -> (name, type) pair in the trace manager dictionary AddName(int, string, string) // save the trace to file (if active) and return flag indicating whether file creatation actually happened WriteToFile(string) bool }
The TraceManager interface helps integrate use of the mrnes functionality for managing traces in the pces package
type XCPEdge ¶
type XCPEdge struct { SrcCP string DstCP string SrcLabel string DstLabel string MsgType string MethodCode string }
XCPEdge describes an edge between different CmpPtns.
These are always rooted in a function of the chgCP class,
where they are organized in a map whose index is the ultimate target CP for a message. The attribute is an XCPEdge, which specifies (a) the identity of the next CmpPtn, (b) the identity of the function to receive the message, (c) the type of the X-CP message, and (d) the methodCode for the function method to be executed. Note that this structure limits one XCPEdge per chgCP instance per target CP.