3 /* gras_bandwidth - GRAS mecanism to do Bandwidth tests between to hosts */
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #ifndef GRAS_BANDWIDTH_H
11 #define GRAS_BANDWIDTH_H
13 #include <gras/modules/base.h>
15 /* ****************************************************************************
16 * The messages themselves
17 * ****************************************************************************/
19 #ifndef GRAS_BANDWIDTH_FIRST_MESSAGE
20 #define GRAS_BANDWIDTH_FIRST_MESSAGE 0
23 #define GRASMSG_BW_REQUEST GRAS_BANDWIDTH_FIRST_MESSAGE
24 #define GRASMSG_BW_RESULT GRAS_BANDWIDTH_FIRST_MESSAGE+1
25 #define GRASMSG_BW_HANDSHAKE GRAS_BANDWIDTH_FIRST_MESSAGE+2
26 #define GRASMSG_BW_HANDSHAKED GRAS_BANDWIDTH_FIRST_MESSAGE+3
28 #define GRASMSG_SAT_START GRAS_BANDWIDTH_FIRST_MESSAGE+4
29 #define GRASMSG_SAT_STARTED GRAS_BANDWIDTH_FIRST_MESSAGE+5
30 #define GRASMSG_SAT_STOP GRAS_BANDWIDTH_FIRST_MESSAGE+6
31 #define GRASMSG_SAT_STOPPED GRAS_BANDWIDTH_FIRST_MESSAGE+7
33 #define GRASMSG_SAT_BEGIN GRAS_BANDWIDTH_FIRST_MESSAGE+8
34 #define GRASMSG_SAT_BEGUN GRAS_BANDWIDTH_FIRST_MESSAGE+9
35 #define GRASMSG_SAT_END GRAS_BANDWIDTH_FIRST_MESSAGE+10
36 #define GRASMSG_SAT_ENDED GRAS_BANDWIDTH_FIRST_MESSAGE+11
38 /* ****************************************************************************
39 * The functions to triger those messages
40 * ****************************************************************************/
43 * grasbw_register_messages:
45 * Register all messages and callbacks needed for the current process to be ready
48 xbt_error_t grasbw_register_messages(void);
50 /* ***************************************************************************
52 * ***************************************************************************/
55 * @to_name: Name of the host with which we should conduct the experiment
56 * @to_port: port on which the peer process is listening (for message, do not
57 * give a raw socket here. The needed raw socket will be negociated between
59 * @bufSize: Size of the socket buffer
60 * @expSize: Total size of data sent across the network
61 * @msgSize: Size of each message sent. Ie, (@expSize % @msgSize) messages will be sent.
62 * @sec: where the result (in seconds) should be stored.
63 * @bw: observed Bandwidth (in Mb/s)
65 * Conduct a bandwidth test from the local process to the given peer.
66 * This call is blocking until the end of the experiment.
68 xbt_error_t grasbw_test(const char*to_name,unsigned int to_port,
69 unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
70 /*OUT*/ double *sec, double*bw);
74 * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
75 * @from_port: port on which the process we are asking for an experiment is listening for message
76 * @to_name: Name of the host with which we should conduct the experiment
77 * @to_port: port on which the peer process is listening (for message, do not
78 * give a raw socket here. The needed raw socket will be negociated between
80 * @bufSize: Size of the socket buffer
81 * @expSize: Total size of data sent across the network
82 * @msgSize: Size of each message sent. Ie, (@expSize % @msgSize) messages will be sent.
83 * @sec: where the result (in seconds) should be stored.
84 * @bw: observed Bandwidth (in Mb/s)
86 * Conduct a bandwidth test from the process from_host:from_port to to_host:to_port.
87 * This call is blocking until the end of the experiment.
89 xbt_error_t grasbw_request(const char* from_name,unsigned int from_port,
90 const char* to_name,unsigned int to_port,
91 unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
92 /*OUT*/ double *sec, double*bw);
95 /* ***************************************************************************
97 * ***************************************************************************/
100 * grasbw_saturate_start:
101 * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
102 * @from_port: port on which the process we are asking for an experiment is listening
103 * (for message, do not give a raw socket here. The needed raw socket will be negociated
105 * @to_name: Name of the host with which we should conduct the experiment
106 * @to_port: port on which the peer process is listening for message
107 * @msgSize: Size of each message sent.
108 * @timeout: How long in maximum should be the saturation.
110 * Ask the process 'from_name:from_port' to start to saturate the link between itself
111 * and to_name:to_name.
113 xbt_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
114 const char* to_name,unsigned int to_port,
115 unsigned int msgSize, unsigned int timeout);
118 * grasbw_saturate_stop:
119 * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
120 * @from_port: port on which the process we are asking for an experiment is listening
121 * (for message, do not give a raw socket here. The needed raw socket will be negociated
123 * @to_name: Name of the host with which we should conduct the experiment
124 * @to_port: port on which the peer process is listening for message
126 * Ask the process 'from_name:from_port' to stop saturating the link between itself
127 * and to_name:to_name.
129 xbt_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
130 const char* to_name,unsigned int to_port);
134 #endif /* GRAS_BANDWIDTH_H */