Network Profile¶
Network Profile implements the Profile class. This class provides all the members and functions neccessary to model, compose, and analyze network profiles for applications and systems.
-
class
Profile
(kind=None, period=0, priority=0, node=0, flow_type=None, num_periods=1, sender_names=[])¶ Profile contains the information about a single network profie. A network profile has a kind (e.g. ‘provided’), a period (in seconds), and a lists of relevant data vs time series (e.g. bandwidth, latency, data, etc.).
Parameters: - kind (string) – what kind of profile is it?
- period (double) – what is the periodicity (in seconds) of the profile
- priority (int) – what is the priority of the flow in the system
- source (int) – what is the node id from which the data on this profile will be sent
- dest (int) – what is the node id to which the data on this profile will be sent
-
field_delimeter
= ','¶ Sepearates fileds in a line in a profile file
-
header_delimeter
= '#'¶ Denotes headers (profile properties) in a profile file
-
comment_delimeter
= '%'¶ Denotes commends in the profile file
-
line_delimeter
= '\n'¶ Splits lines in a profile file
-
special_delimeters
= ['#', '%']¶ Strip lines starting with these delimeters to get just profile data
-
interpolated_profiles
= ['data', 'latency']¶ Which profiles are interpolated between points
-
kind
= None¶ The kind of this profile, e.g. ‘required’
-
period
= None¶ The length of one period of this profile
-
priority
= None¶ The priority of the profile; relevant for ‘required’ profiles
-
node_id
= None¶ The node ID which is the source of this profile
-
flow_type
= None¶ This flow is the reciever for which sender flows?
-
entries
= None¶ Dictionary of ‘type name’ : ‘list of [x,y] points’ k:v pairs
-
ParseHeader
(header)¶ Parses information from the profile’s header if it exists:
- period
- priority
- node ID
- flow_type (for matching senders <–> receivers)
- profile kind (provided, required, receiver, output, leftover)
A profile header is at the top of the file and has the following syntax:
# <property> = <value>
-
ParseFromFile
(prof_fName)¶ Builds the entries from a properly formatted CSV file. Internally calls
Profile.ParseFromString()
.
-
ParseFromString
(prof_str)¶ Builds the entries from a string (line list of csv’s formatted as per
ParseEntriesFromLine()
).
-
ParseEntriesFromLine
(line_str)¶ Builds the [time, value] list for each type of value into entries:
- slope
- max slope
- latency
These values are formatted in the csv as:
<time>, <slope>, <max slope>, <latency>
-
EntriesRemoveDegenerates
()¶ Remove duplicate entries by time stamp.
-
AggregateSlopes
()¶ Remove sequential entries which have the same slope.
-
EntriesStartFill
()¶ Make sure all entries have a start time of 0.
-
Repeat
(num_periods)¶ Copy the current profile entries over some number of its periods.
-
Integrate
(time)¶ Integrates the slope entries to produce data entries up to time
-
Derive
()¶ Derives the slope entries from the data entries
-
IsKind
(kind)¶ Returns True if the profile is of type kind, False otherwise.
-
Kind
(kind)¶ Set the kind of the profile.
-
Shrink
(t)¶ Shrink the profile to be <= t.
-
AddProfile
(profile)¶ Compose this profile with an input profile by adding their slopes together.
Return type: Profile
-
SubtractProfile
(profile)¶ Compose this profile with an input profile by subtracting the input profile’s slopes.
Return type: Profile
-
MakeGraphPointsSlope
()¶ Return matplotlib plottable x and y series for the slope of the profile.
-
MakeGraphPointsData
()¶ Return matplotlib plottable x and y series for the data of the profile.
-
GetValueAtTime
(key, t, interpolate=True)¶ Return the value at time t from series key, optionally interpolating between.
-
ToString
(prefix='')¶ Returns a string version of the profile, with all values properly tabulated.
Return type: string()
Parameters: prefix (in) – string to be prepended to every line of the returned string.
-
ConvertToNC
(filterFunc, step=0)¶ Perform time-window based integration to generate a Network Calculus curve from the profile. The conversion is configurable based on time-window step-size and a filter function (e.g. min or max). Passing
max()
will create an arrival curve, while passingmin()
will create a service curve.Return type: Profile
, the network-calculus version of the self profileNote
Requires the profile to have been integrated
-
CalcDelay
(output)¶ Compute the maximum horizontal distance between this profile and the input profile.
This function implements the operation (see Mathematical Formalism):
Where
is the inverse map of the ouptut profile, e.g. a function mapping output data to time
is the inverse map of the required profile, e.g. a function mapping required data to time
Return type: list()
of the form:[ <time>, <data>, <length of delay> ]
Parameters: output (in) – a Profile
describing the output profile
-
CalcBuffer
(output)¶ Compute the maximum vertical distance between this profile and the input profile.
This function implements the operation (see Mathematical Formalism):
Where
is the output profile (see
Profile.Convolve()
)is the required profile (self)
Return type: list()
of the form:[ <time>, <data>, <size of the buffer> ]
Parameters: output (in) – a Profile
describing the output profile
-
Delay
(delayProf)¶ Compute the delayed profile composed of self profile and delayProf, received by a node for which this self profile is the output profile on the sender side. The delay profile describes the delay as a function of time for the link.
This function implements the operation:
Where
is the delay profile
is the profile transmitted into the link (self)
is the output profile received at the other end of the link
Return type: Profile
,Parameters: delayProf (in) – Profile
describing the delay
-
Convolve
(provided)¶ Use min-plus calculus to convolve this required profile with an input provided profile.
This function implements the operation (see Mathematical Formalism):
Where
is the data profile required by the application (self)
is the data profile provided by the node’s link
is the data profile transmitted onto the link
Return type: Profile
,Parameters: provided (in) – a Profile
describing the node’s provided link profile