SimGrid 3.7.1
Scalable simulation of distributed systems
Functions
Using measurement sockets
XBT_sock

Functions

int xbt_socket_is_meas (xbt_socket_t sock)
 Check if the provided socket is a measurement one (or a regular one)
void xbt_socket_meas_send (xbt_socket_t peer, unsigned int timeout, unsigned long int msgSize, unsigned long int msgAmount)
 Send a chunk of (random) data over a measurement socket.
void xbt_socket_meas_recv (xbt_socket_t peer, unsigned int timeout, unsigned long int msgSize, unsigned long int msgAmount)
 Receive a chunk of data over a measurement socket.
xbt_socket_t xbt_socket_meas_accept (xbt_socket_t peer)
 Something similar to the good old accept system call.

Detailed Description

You may want to use sockets not to exchange valuable data (in messages), but to conduct some bandwidth measurements and related experiments. If so, try those measurement sockets.

You can only use those functions on sockets opened with the "measurement" boolean set to true.


Function Documentation

void xbt_socket_meas_send ( xbt_socket_t  peer,
unsigned int  timeout,
unsigned long int  msg_size,
unsigned long int  msg_amount 
)

Send a chunk of (random) data over a measurement socket.

Parameters:
peermeasurement socket to use for the experiment
timeouttimeout (in seconds)
msg_sizesize of each chunk sent over the socket (in bytes).
msg_amounthow many of these packets you want to send.

Calls to xbt_socket_meas_send() and xbt_socket_meas_recv() on each side of the socket should be paired.

The exchanged data is zeroed to make sure it's initialized, but there is no way to control what is sent (ie, you cannot use these functions to exchange data out of band).

Warning:
: in SimGrid version 3.1 and previous, the numerical arguments were the total amount of data to send and the msg_size. This was changed for the fool wanting to send more than MAXINT bytes in a fat pipe.
void xbt_socket_meas_recv ( xbt_socket_t  peer,
unsigned int  timeout,
unsigned long int  msg_size,
unsigned long int  msg_amount 
)

Receive a chunk of data over a measurement socket.

Calls to xbt_socket_meas_send() and xbt_socket_meas_recv() on each side of the socket should be paired.

Warning:
: in SimGrid version 3.1 and previous, the numerical arguments were the total amount of data to send and the msg_size. This was changed for the fool wanting to send more than MAXINT bytes in a fat pipe.
xbt_socket_t xbt_socket_meas_accept ( xbt_socket_t  peer)

Something similar to the good old accept system call.

Make sure that there is someone speaking to the provided server socket. In RL, it does an accept(2) and return the result as last argument. In SG, as accepts are useless, it returns the provided argument as result. You should thus test whether (peer != accepted) before closing both of them.

You should only call this on measurement sockets. It is automatically done for regular sockets, but you usually want more control about what's going on with measurement sockets.


Back to the main Simgrid Documentation page The version of SimGrid documented here is v3.7.1.
Documentation of other versions can be found in their respective archive files (directory doc/html).
Generated by doxygen