Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fixed licence and copyright. No more reference to da GRAS possee or the
[simgrid.git] / include / gras / modules / bandwidth.h
1 /* $Id$ */
2
3 /* gras_bandwidth - GRAS mecanism to do Bandwidth tests between to hosts    */
4
5 /* Copyright (c) 2004 Martin Quinson. All rights reserved.                  */
6
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. */
9
10 #ifndef GRAS_BANDWIDTH_H
11 #define GRAS_BANDWIDTH_H
12
13 #include <gras/modules/base.h>
14
15 /* ****************************************************************************
16  * The messages themselves
17  * ****************************************************************************/
18
19 #ifndef GRAS_BANDWIDTH_FIRST_MESSAGE
20 #define GRAS_BANDWIDTH_FIRST_MESSAGE 0
21 #endif
22
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
27
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
32
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
37
38 /* ****************************************************************************
39  * The functions to triger those messages
40  * ****************************************************************************/
41
42 /**
43  * grasbw_register_messages:
44  *
45  * Register all messages and callbacks needed for the current process to be ready
46  * to do BW tests
47  */
48 xbt_error_t grasbw_register_messages(void);
49
50 /* ***************************************************************************
51  * Bandwidth tests
52  * ***************************************************************************/
53 /**
54  * grasbw_test:
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 
58  * the peers)
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)
64  *
65  * Conduct a bandwidth test from the local process to the given peer.
66  * This call is blocking until the end of the experiment.
67  */
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);
71
72 /**
73  * grasbw_request:
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 
79  * the peers)
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)
85  *
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.
88  */
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);
93
94
95 /* ***************************************************************************
96  * Link saturation
97  * ***************************************************************************/
98
99 /**
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 
104  * between the peers)
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.
109  *
110  * Ask the process 'from_name:from_port' to start to saturate the link between itself
111  * and to_name:to_name.
112  */
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);
116
117 /**
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 
122  * between the peers)
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
125  *
126  * Ask the process 'from_name:from_port' to stop saturating the link between itself
127  * and to_name:to_name.
128  */
129 xbt_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
130                                  const char* to_name,unsigned int to_port);
131
132
133
134 #endif /* GRAS_BANDWIDTH_H */