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.c | |
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.c')
-rw-r--r-- | src/ats-tests/perf_ats.c | 169 |
1 files changed, 4 insertions, 165 deletions
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c index 9f4c48f8b..bdd306ec4 100644 --- a/src/ats-tests/perf_ats.c +++ b/src/ats-tests/perf_ats.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "gnunet_testbed_service.h" | 28 | #include "gnunet_testbed_service.h" |
29 | #include "gnunet_ats_service.h" | 29 | #include "gnunet_ats_service.h" |
30 | #include "gnunet_core_service.h" | 30 | #include "gnunet_core_service.h" |
31 | #include "perf_ats_logging.h" | 31 | #include "perf_ats.h" |
32 | 32 | ||
33 | #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | 33 | #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) |
34 | #define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | 34 | #define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
@@ -46,52 +46,6 @@ | |||
46 | #define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | 46 | #define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Information about a benchmarking partner | ||
50 | */ | ||
51 | struct BenchmarkPartner | ||
52 | { | ||
53 | /** | ||
54 | * The peer itself this partner belongs to | ||
55 | */ | ||
56 | struct BenchmarkPeer *me; | ||
57 | |||
58 | /** | ||
59 | * The partner peer | ||
60 | */ | ||
61 | struct BenchmarkPeer *dest; | ||
62 | |||
63 | /** | ||
64 | * Core transmit handles | ||
65 | */ | ||
66 | struct GNUNET_CORE_TransmitHandle *cth; | ||
67 | |||
68 | /** | ||
69 | * Transport transmit handles | ||
70 | */ | ||
71 | struct GNUNET_TRANSPORT_TransmitHandle *tth; | ||
72 | |||
73 | /** | ||
74 | * Number of messages sent to this partner | ||
75 | */ | ||
76 | unsigned int messages_sent; | ||
77 | |||
78 | /** | ||
79 | * Number of bytes sent to this partner | ||
80 | */ | ||
81 | unsigned int bytes_sent; | ||
82 | |||
83 | /** | ||
84 | * Number of messages received from this partner | ||
85 | */ | ||
86 | unsigned int messages_received; | ||
87 | |||
88 | /** | ||
89 | * Number of bytes received from this partner | ||
90 | */ | ||
91 | unsigned int bytes_received; | ||
92 | }; | ||
93 | |||
94 | /** | ||
95 | * Connect peers with testbed | 49 | * Connect peers with testbed |
96 | */ | 50 | */ |
97 | struct TestbedConnectOperation | 51 | struct TestbedConnectOperation |
@@ -113,123 +67,6 @@ struct TestbedConnectOperation | |||
113 | }; | 67 | }; |
114 | 68 | ||
115 | /** | 69 | /** |
116 | * Information we track for a peer in the testbed. | ||
117 | */ | ||
118 | struct BenchmarkPeer | ||
119 | { | ||
120 | /** | ||
121 | * Handle with testbed. | ||
122 | */ | ||
123 | struct GNUNET_TESTBED_Peer *peer; | ||
124 | |||
125 | /** | ||
126 | * Unique identifier | ||
127 | */ | ||
128 | int no; | ||
129 | |||
130 | /** | ||
131 | * Is this peer a measter: GNUNET_YES/GNUNET_NO | ||
132 | */ | ||
133 | int master; | ||
134 | |||
135 | /** | ||
136 | * Peer ID | ||
137 | */ | ||
138 | struct GNUNET_PeerIdentity id; | ||
139 | |||
140 | /** | ||
141 | * Testbed operation to get peer information | ||
142 | */ | ||
143 | struct GNUNET_TESTBED_Operation *peer_id_op; | ||
144 | |||
145 | /** | ||
146 | * Testbed operation to connect to ATS performance service | ||
147 | */ | ||
148 | struct GNUNET_TESTBED_Operation *ats_perf_op; | ||
149 | |||
150 | /** | ||
151 | * Testbed operation to connect to core | ||
152 | */ | ||
153 | struct GNUNET_TESTBED_Operation *comm_op; | ||
154 | |||
155 | /** | ||
156 | * ATS performance handle | ||
157 | */ | ||
158 | struct GNUNET_ATS_PerformanceHandle *ats_perf_handle; | ||
159 | |||
160 | /** | ||
161 | * Masters only: | ||
162 | * Testbed connect operations to connect masters to slaves | ||
163 | */ | ||
164 | struct TestbedConnectOperation *core_connect_ops; | ||
165 | |||
166 | /** | ||
167 | * Core handle | ||
168 | */ | ||
169 | struct GNUNET_CORE_Handle *ch; | ||
170 | |||
171 | /** | ||
172 | * Core handle | ||
173 | */ | ||
174 | struct GNUNET_TRANSPORT_Handle *th; | ||
175 | |||
176 | /** | ||
177 | * Masters only: | ||
178 | * Peer to set ATS preferences for | ||
179 | */ | ||
180 | struct BenchmarkPeer *pref_partner; | ||
181 | |||
182 | /** | ||
183 | * Masters only | ||
184 | * Progress task | ||
185 | */ | ||
186 | GNUNET_SCHEDULER_TaskIdentifier ats_task; | ||
187 | |||
188 | /** | ||
189 | * Masters only | ||
190 | * Progress task | ||
191 | */ | ||
192 | double pref_value; | ||
193 | |||
194 | /** | ||
195 | * Array of partners with num_slaves entries (if master) or | ||
196 | * num_master entries (if slave) | ||
197 | */ | ||
198 | struct BenchmarkPartner *partners; | ||
199 | |||
200 | /** | ||
201 | * Number of core connections | ||
202 | */ | ||
203 | int core_connections; | ||
204 | |||
205 | /** | ||
206 | * Masters only: | ||
207 | * Number of connections to slave peers | ||
208 | */ | ||
209 | int core_slave_connections; | ||
210 | |||
211 | /** | ||
212 | * Total number of messages this peer has sent | ||
213 | */ | ||
214 | unsigned int total_messages_sent; | ||
215 | |||
216 | /** | ||
217 | * Total number of bytes this peer has sent | ||
218 | */ | ||
219 | unsigned int total_bytes_sent; | ||
220 | |||
221 | /** | ||
222 | * Total number of messages this peer has received | ||
223 | */ | ||
224 | unsigned int total_messages_received; | ||
225 | |||
226 | /** | ||
227 | * Total number of bytes this peer has received | ||
228 | */ | ||
229 | unsigned int total_bytes_received; | ||
230 | }; | ||
231 | |||
232 | /** | ||
233 | * Overall state of the performance benchmark | 70 | * Overall state of the performance benchmark |
234 | */ | 71 | */ |
235 | struct BenchmarkState | 72 | struct BenchmarkState |
@@ -614,7 +451,7 @@ do_benchmark () | |||
614 | mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]); | 451 | mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]); |
615 | } | 452 | } |
616 | if (GNUNET_YES == logging) | 453 | if (GNUNET_YES == logging) |
617 | perf_logging_start(); | 454 | perf_logging_start (mps, num_masters); |
618 | } | 455 | } |
619 | 456 | ||
620 | static void | 457 | static void |
@@ -1209,6 +1046,7 @@ main_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, | |||
1209 | mps[c_m].pref_value = TEST_ATS_PREFRENCE_START; | 1046 | mps[c_m].pref_value = TEST_ATS_PREFRENCE_START; |
1210 | mps[c_m].partners = | 1047 | mps[c_m].partners = |
1211 | GNUNET_malloc (num_slaves * sizeof (struct BenchmarkPeer)); | 1048 | GNUNET_malloc (num_slaves * sizeof (struct BenchmarkPeer)); |
1049 | mps[c_m].num_partners = num_slaves; | ||
1212 | /* Initialize partners */ | 1050 | /* Initialize partners */ |
1213 | for (c_s = 0; c_s < num_slaves; c_s++) | 1051 | for (c_s = 0; c_s < num_slaves; c_s++) |
1214 | { | 1052 | { |
@@ -1228,6 +1066,7 @@ main_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, | |||
1228 | sps[c_s].master = GNUNET_NO; | 1066 | sps[c_s].master = GNUNET_NO; |
1229 | sps[c_s].partners = | 1067 | sps[c_s].partners = |
1230 | GNUNET_malloc (num_masters * sizeof (struct BenchmarkPeer)); | 1068 | GNUNET_malloc (num_masters * sizeof (struct BenchmarkPeer)); |
1069 | sps[c_s].num_partners = num_masters; | ||
1231 | /* Initialize partners */ | 1070 | /* Initialize partners */ |
1232 | for (c_m = 0; c_m < num_masters; c_m++) | 1071 | for (c_m = 0; c_m < num_masters; c_m++) |
1233 | { | 1072 | { |