1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
/*
This file is part of GNUnet.
(C) 2010-2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/**
* @file ats/perf_ats.c
* @brief ats benchmark: start peers and modify preferences, monitor change over time
* @author Christian Grothoff
* @author Matthias Wachs
*/
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "gnunet_ats_service.h"
#include "gnunet_core_service.h"
#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500)
#define TESTNAME_PREFIX "perf_ats_"
#define DEFAULT_SLAVES_NUM 3
#define DEFAULT_MASTERS_NUM 1
#define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
#define TEST_ATS_PREFRENCE_START 1.0
#define TEST_ATS_PREFRENCE_DELTA 1.0
#define TEST_MESSAGE_TYPE_PING 12345
#define TEST_MESSAGE_TYPE_PONG 12346
#define TEST_MESSAGE_SIZE 1000
#define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
/**
* Information about a benchmarking partner
*/
struct BenchmarkPartner
{
/**
* The peer itself this partner belongs to
*/
struct BenchmarkPeer *me;
/**
* The partner peer
*/
struct BenchmarkPeer *dest;
/**
* Core transmit handles
*/
struct GNUNET_CORE_TransmitHandle *cth;
/**
* Transport transmit handles
*/
struct GNUNET_TRANSPORT_TransmitHandle *tth;
/**
* Timestamp to calculate communication layer delay
*/
struct GNUNET_TIME_Absolute last_message_sent;
/**
* Accumulated delay for all messages
*/
unsigned int total_app_delay;
/**
* Number of messages sent to this partner
*/
unsigned int messages_sent;
/**
* Number of bytes sent to this partner
*/
unsigned int bytes_sent;
/**
* Number of messages received from this partner
*/
unsigned int messages_received;
/**
* Number of bytes received from this partner
*/
unsigned int bytes_received;
};
/**
* Information we track for a peer in the testbed.
*/
struct BenchmarkPeer
{
/**
* Handle with testbed.
*/
struct GNUNET_TESTBED_Peer *peer;
/**
* Unique identifier
*/
int no;
/**
* Is this peer a measter: GNUNET_YES/GNUNET_NO
*/
int master;
/**
* Peer ID
*/
struct GNUNET_PeerIdentity id;
/**
* Testbed operation to get peer information
*/
struct GNUNET_TESTBED_Operation *peer_id_op;
/**
* Testbed operation to connect to ATS performance service
*/
struct GNUNET_TESTBED_Operation *ats_perf_op;
/**
* Testbed operation to connect to core
*/
struct GNUNET_TESTBED_Operation *comm_op;
/**
* ATS performance handle
*/
struct GNUNET_ATS_PerformanceHandle *ats_perf_handle;
/**
* Masters only:
* Testbed connect operations to connect masters to slaves
*/
struct TestbedConnectOperation *core_connect_ops;
/**
* Core handle
*/
struct GNUNET_CORE_Handle *ch;
/**
* Core handle
*/
struct GNUNET_TRANSPORT_Handle *th;
/**
* Masters only:
* Peer to set ATS preferences for
*/
struct BenchmarkPeer *pref_partner;
/**
* Masters only
* Progress task
*/
GNUNET_SCHEDULER_TaskIdentifier ats_task;
/**
* Masters only
* Progress task
*/
double pref_value;
/**
* Array of partners with num_slaves entries (if master) or
* num_master entries (if slave)
*/
struct BenchmarkPartner *partners;
/**
* Number of partners
*/
int num_partners;
/**
* Number of core connections
*/
int core_connections;
/**
* Masters only:
* Number of connections to slave peers
*/
int core_slave_connections;
/**
* Total number of messages this peer has sent
*/
unsigned int total_messages_sent;
/**
* Total number of bytes this peer has sent
*/
unsigned int total_bytes_sent;
/**
* Total number of messages this peer has received
*/
unsigned int total_messages_received;
/**
* Total number of bytes this peer has received
*/
unsigned int total_bytes_received;
};
void
perf_logging_stop ();
void
perf_logging_start (struct GNUNET_TIME_Relative log_frequency,
char * testname, struct BenchmarkPeer *masters, int num_masters);
/* end of file perf_ats.h */
|