Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add gras_datadesc_declare_{struct,union}_close; fix the prototypes of the functions...
[simgrid.git] / include / modules / bandwidth.h
1 /* $Id$ */
2
3 /* gras_bandwidth - GRAS mecanism to do Bandwidth tests between to hosts    */
4
5 /* Authors: Martin Quinson                                                  */
6 /* Copyright (C) 2003 the OURAGAN project.                                  */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #ifndef GRAS_BANDWIDTH_H
12 #define GRAS_BANDWIDTH_H
13
14 #include <gras/modules/base.h>
15
16 /* ****************************************************************************
17  * The messages themselves
18  * ****************************************************************************/
19
20 #ifndef GRAS_BANDWIDTH_FIRST_MESSAGE
21 #define GRAS_BANDWIDTH_FIRST_MESSAGE 0
22 #endif
23
24 #define GRASMSG_BW_REQUEST    GRAS_BANDWIDTH_FIRST_MESSAGE
25 #define GRASMSG_BW_RESULT     GRAS_BANDWIDTH_FIRST_MESSAGE+1
26 #define GRASMSG_BW_HANDSHAKE  GRAS_BANDWIDTH_FIRST_MESSAGE+2
27 #define GRASMSG_BW_HANDSHAKED GRAS_BANDWIDTH_FIRST_MESSAGE+3
28
29 #define GRASMSG_SAT_START     GRAS_BANDWIDTH_FIRST_MESSAGE+4
30 #define GRASMSG_SAT_STARTED   GRAS_BANDWIDTH_FIRST_MESSAGE+5
31 #define GRASMSG_SAT_STOP      GRAS_BANDWIDTH_FIRST_MESSAGE+6
32 #define GRASMSG_SAT_STOPPED   GRAS_BANDWIDTH_FIRST_MESSAGE+7
33
34 #define GRASMSG_SAT_BEGIN     GRAS_BANDWIDTH_FIRST_MESSAGE+8
35 #define GRASMSG_SAT_BEGUN     GRAS_BANDWIDTH_FIRST_MESSAGE+9
36 #define GRASMSG_SAT_END       GRAS_BANDWIDTH_FIRST_MESSAGE+10
37 #define GRASMSG_SAT_ENDED     GRAS_BANDWIDTH_FIRST_MESSAGE+11
38
39 /* ****************************************************************************
40  * The functions to triger those messages
41  * ****************************************************************************/
42
43 /**
44  * grasbw_register_messages:
45  *
46  * Register all messages and callbacks needed for the current process to be ready
47  * to do BW tests
48  */
49 gras_error_t grasbw_register_messages(void);
50
51 /* ***************************************************************************
52  * Bandwidth tests
53  * ***************************************************************************/
54 /**
55  * grasbw_test:
56  * @to_name: Name of the host with which we should conduct the experiment
57  * @to_port: port on which the peer process is listening (for message, do not 
58  * give a raw socket here. The needed raw socket will be negociated between 
59  * the peers)
60  * @bufSize: Size of the socket buffer
61  * @expSize: Total size of data sent across the network
62  * @msgSize: Size of each message sent. Ie, (@expSize % @msgSize) messages will be sent.
63  * @sec: where the result (in seconds) should be stored.
64  * @bw: observed Bandwidth (in Mb/s)
65  *
66  * Conduct a bandwidth test from the local process to the given peer.
67  * This call is blocking until the end of the experiment.
68  */
69 gras_error_t grasbw_test(const char*to_name,unsigned int to_port,
70                         unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
71                         /*OUT*/ double *sec, double*bw);
72
73 /**
74  * grasbw_request:
75  * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
76  * @from_port: port on which the process we are asking for an experiment is listening for message
77  * @to_name: Name of the host with which we should conduct the experiment
78  * @to_port: port on which the peer process is listening (for message, do not 
79  * give a raw socket here. The needed raw socket will be negociated between 
80  * the peers)
81  * @bufSize: Size of the socket buffer
82  * @expSize: Total size of data sent across the network
83  * @msgSize: Size of each message sent. Ie, (@expSize % @msgSize) messages will be sent.
84  * @sec: where the result (in seconds) should be stored.
85  * @bw: observed Bandwidth (in Mb/s)
86  *
87  * Conduct a bandwidth test from the process from_host:from_port to to_host:to_port.
88  * This call is blocking until the end of the experiment.
89  */
90 gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
91                            const char* to_name,unsigned int to_port,
92                            unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
93                            /*OUT*/ double *sec, double*bw);
94
95
96 /* ***************************************************************************
97  * Link saturation
98  * ***************************************************************************/
99
100 /**
101  * grasbw_saturate_start:
102  * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
103  * @from_port: port on which the process we are asking for an experiment is listening
104  * (for message, do not give a raw socket here. The needed raw socket will be negociated 
105  * between the peers)
106  * @to_name: Name of the host with which we should conduct the experiment
107  * @to_port: port on which the peer process is listening for message
108  * @msgSize: Size of each message sent.
109  * @timeout: How long in maximum should be the saturation.
110  *
111  * Ask the process 'from_name:from_port' to start to saturate the link between itself
112  * and to_name:to_name.
113  */
114 gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
115                                   const char* to_name,unsigned int to_port,
116                                   unsigned int msgSize, unsigned int timeout);
117
118 /**
119  * grasbw_saturate_stop:
120  * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
121  * @from_port: port on which the process we are asking for an experiment is listening
122  * (for message, do not give a raw socket here. The needed raw socket will be negociated 
123  * between the peers)
124  * @to_name: Name of the host with which we should conduct the experiment
125  * @to_port: port on which the peer process is listening for message
126  *
127  * Ask the process 'from_name:from_port' to stop saturating the link between itself
128  * and to_name:to_name.
129  */
130 gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
131                                  const char* to_name,unsigned int to_port);
132
133
134
135 #endif /* GRAS_BANDWIDTH_H */