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