Network Profile

class profileMemBuf

This structuture creates a stream buffer for parsing csv profile files.

class ResourceEntry
time

Contains the start time for the resource entry.

Return type:float
bandwidth

The bandwidth (bps) which is constant from the start of the entry to its end.

Return type:unsigned long long
data

The cumulative data (bits) which have been sent by the end of this resource entry. Includes all summation of all previous entries’ data.

Return type:unsigned long long
latency

The latency (ms) for network traffic during this entry.

Return type:unsigned long long
class NetworkProfile

A network profile contains a sorted list of time- and data-contiguous entries of type ResourceEntry. The profiles are periodic with a specific epoch-centric start-time.

resources
Return type:std::vector<ResourceEntry>
start__time
Return type:timespec
period
Return type:double
initialize_from_file(fname)

Load in the profile specified by fname. Return 0 on success, -1 on error.

Parameters:char* fname (const) – The filename containing a csv-delimited profile
Return type:int
initialize_from_string(buffer)

Load in the profile contained in buffer. Return 0 on success, -1 on error.

Parameters:buffer (char*) – A string buffer containing the csv-delimited profile
Return type:int
initialize_from_i_stream(stream)

Load in the profile contained in stream. Return 0 on success, -1 on error.

Parameters:stream (std::istream&) – An istream containing the csv-delimited profile
Return type:int
get_offset(t)

Returns the difference between t and the profile’s start time, modulo the profile’s period.

Parameters:timespec& t (out) – epoch-centric time value
Return type:double
get_next_interval(start, bandwidth, latency)

Returns as output parameters the next interval by comparing the current system epoch time to the profile’s start epoch time. IF the profile has not been properly initialized, the call fails and returns -1, else it fills the output parameters and returns 0.

Parameters:
  • timespec& start (out) – epoch time when the next interval starts
  • unsigned long long& bandwidth (out) – bandwidth during the next interval
  • unsigned long long& latency (out) – latency value for the next interval
Return type:

int

delay(data_len, sent_time)

Returns the amount of time the program has to wait before sending again. This is calculated based using the input data_lengh that was last transmitted at sent_time, and takes into account the current system itme.

Parameters:
  • unsigned long data_len (in) – size of the message that was last sent
  • timespec sent_time (in) – epoch time the message of length dataLen was sent
Return type:

double

initialized()

Returns true if the profile was properly initialized, false otherwise.

Return type:bool