#include "amok/Bandwidth/bandwidth_private.h"
#include "gras/messages.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(bw,amok,"Bandwidth testing");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_bw,amok,"Bandwidth testing");
/******************************
* \brief bandwidth measurement between localhost and \e peer
*
* \arg peer: A (regular) socket at which the the host with which we should conduct the experiment can be contacted
- * \arg buf_size: Size of the socket buffer
+ * \arg buf_size: Size of the socket buffer. If 0, a sain default is used (32k, but may change)
* \arg exp_size: Total size of data sent across the network
* \arg msg_size: Size of each message sent. Ie, (\e expSize % \e msgSize) messages will be sent.
* \arg sec: where the result (in seconds) should be stored.
* \arg to_port: port on which the second process is listening (for messages, do not
* give a measurement socket here. The needed measurement sockets will be created
* automatically and negociated between the peers)
- * \arg buf_size: Size of the socket buffer
+ * \arg buf_size: Size of the socket buffer. If 0, a sain default is used (32k, but may change)
* \arg exp_size: Total size of data sent across the network
* \arg msg_size: Size of each message sent. (\e expSize % \e msgSize) messages will be sent.
* \arg sec: where the result (in seconds) should be stored.
sock = gras_socket_client(from_name,from_port);
gras_msg_rpccall(sock,240,gras_msgtype_by_name("BW request"),&request, &result);
- *sec=result->sec;
- *bw =result->bw;
+ if (sec)
+ *sec=result->sec;
+ if (bw)
+ *bw =result->bw;
VERB6("BW test between %s:%d and %s:%d took %f sec, achieving %f kb/s",
from_name,from_port, to_name,to_port,
gras_os_sleep(1);
gras_socket_close(peer);
+ free(request->host.name);
free(request);
free(result);