diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-19 07:45:09 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-19 07:45:09 +0000 |
commit | cfdc5b2d2c092cdb5efa5a64e9cc1df6ef26de58 (patch) | |
tree | 22bfffba75df4e295aa9861d9a28ac6aea2d2f3e /src | |
parent | 59402687b837c12990b00d94799323d327e608bd (diff) | |
download | gnunet-cfdc5b2d2c092cdb5efa5a64e9cc1df6ef26de58.tar.gz gnunet-cfdc5b2d2c092cdb5efa5a64e9cc1df6ef26de58.zip |
slave logging
Diffstat (limited to 'src')
-rw-r--r-- | src/ats-tests/perf_ats.c | 20 | ||||
-rw-r--r-- | src/ats-tests/perf_ats_logging.c | 126 |
2 files changed, 115 insertions, 31 deletions
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c index 67ff7d0af..a3f60d375 100644 --- a/src/ats-tests/perf_ats.c +++ b/src/ats-tests/perf_ats.c | |||
@@ -359,21 +359,21 @@ static size_t | |||
359 | comm_send_ready (void *cls, size_t size, void *buf) | 359 | comm_send_ready (void *cls, size_t size, void *buf) |
360 | { | 360 | { |
361 | static char msgbuf[TEST_MESSAGE_SIZE]; | 361 | static char msgbuf[TEST_MESSAGE_SIZE]; |
362 | struct BenchmarkPartner *partner = cls; | 362 | struct BenchmarkPartner *p = cls; |
363 | struct GNUNET_MessageHeader *msg; | 363 | struct GNUNET_MessageHeader *msg; |
364 | 364 | ||
365 | if (GNUNET_YES == test_core) | 365 | if (GNUNET_YES == test_core) |
366 | partner->cth = NULL; | 366 | p->cth = NULL; |
367 | else | 367 | else |
368 | partner->tth = NULL; | 368 | p->tth = NULL; |
369 | 369 | ||
370 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Master [%u]: Sending PING to [%u]\n", | 370 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Master [%u]: Sending PING to [%u]\n", |
371 | partner->me->no, partner->dest->no); | 371 | p->me->no, p->dest->no); |
372 | 372 | ||
373 | partner->messages_sent++; | 373 | p->messages_sent++; |
374 | partner->bytes_sent += TEST_MESSAGE_SIZE; | 374 | p->bytes_sent += TEST_MESSAGE_SIZE; |
375 | partner->me->total_messages_sent++; | 375 | p->me->total_messages_sent++; |
376 | partner->me->total_bytes_sent += TEST_MESSAGE_SIZE; | 376 | p->me->total_bytes_sent += TEST_MESSAGE_SIZE; |
377 | 377 | ||
378 | msg = (struct GNUNET_MessageHeader *) &msgbuf; | 378 | msg = (struct GNUNET_MessageHeader *) &msgbuf; |
379 | memset (&msgbuf, 'a', TEST_MESSAGE_SIZE); | 379 | memset (&msgbuf, 'a', TEST_MESSAGE_SIZE); |
@@ -661,8 +661,8 @@ comm_handle_ping (void *cls, const struct GNUNET_PeerIdentity *other, | |||
661 | struct BenchmarkPartner *p = NULL; | 661 | struct BenchmarkPartner *p = NULL; |
662 | for (c_m = 0; c_m < num_masters; c_m++) | 662 | for (c_m = 0; c_m < num_masters; c_m++) |
663 | { | 663 | { |
664 | if (0 | 664 | /* Find a partner with other as destination */ |
665 | == memcmp (other, &me->partners[c_m].dest->id, | 665 | if (0 == memcmp (other, &me->partners[c_m].dest->id, |
666 | sizeof(struct GNUNET_PeerIdentity))) | 666 | sizeof(struct GNUNET_PeerIdentity))) |
667 | { | 667 | { |
668 | p = &me->partners[c_m]; | 668 | p = &me->partners[c_m]; |
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c index 51c09c266..2979dd647 100644 --- a/src/ats-tests/perf_ats_logging.c +++ b/src/ats-tests/perf_ats_logging.c | |||
@@ -27,19 +27,70 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "perf_ats.h" | 28 | #include "perf_ats.h" |
29 | 29 | ||
30 | #define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 100) | 30 | #define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500) |
31 | 31 | ||
32 | |||
33 | /** | ||
34 | * Logging task | ||
35 | */ | ||
32 | static GNUNET_SCHEDULER_TaskIdentifier log_task; | 36 | static GNUNET_SCHEDULER_TaskIdentifier log_task; |
33 | 37 | ||
34 | static struct BenchmarkPeer *peers; | 38 | /** |
39 | * Reference to perf_ats' masters | ||
40 | */ | ||
35 | static int num_peers; | 41 | static int num_peers; |
36 | static char *name; | 42 | static char *name; |
37 | 43 | ||
38 | struct LoggingTimestep | 44 | /** |
45 | * A single logging time step for a partner | ||
46 | */ | ||
47 | struct PartnerLoggingTimestep | ||
48 | { | ||
49 | /** | ||
50 | * Peer | ||
51 | */ | ||
52 | struct BenchmarkPeer *slave; | ||
53 | |||
54 | /** | ||
55 | * Total number of messages this peer has sent | ||
56 | */ | ||
57 | unsigned int total_messages_sent; | ||
58 | |||
59 | /** | ||
60 | * Total number of bytes this peer has sent | ||
61 | */ | ||
62 | unsigned int total_bytes_sent; | ||
63 | |||
64 | /** | ||
65 | * Total number of messages this peer has received | ||
66 | */ | ||
67 | unsigned int total_messages_received; | ||
68 | |||
69 | /** | ||
70 | * Total number of bytes this peer has received | ||
71 | */ | ||
72 | unsigned int total_bytes_received; | ||
73 | }; | ||
74 | |||
75 | |||
76 | /** | ||
77 | * A single logging time step for a peer | ||
78 | */ | ||
79 | struct PeerLoggingTimestep | ||
39 | { | 80 | { |
40 | struct LoggingTimestep *next; | 81 | /** |
41 | struct LoggingTimestep *prev; | 82 | * Next in DLL |
83 | */ | ||
84 | struct PeerLoggingTimestep *next; | ||
42 | 85 | ||
86 | /** | ||
87 | * Prev in DLL | ||
88 | */ | ||
89 | struct PeerLoggingTimestep *prev; | ||
90 | |||
91 | /** | ||
92 | * Logging timestamp | ||
93 | */ | ||
43 | struct GNUNET_TIME_Absolute timestamp; | 94 | struct GNUNET_TIME_Absolute timestamp; |
44 | 95 | ||
45 | /** | 96 | /** |
@@ -61,16 +112,37 @@ struct LoggingTimestep | |||
61 | * Total number of bytes this peer has received | 112 | * Total number of bytes this peer has received |
62 | */ | 113 | */ |
63 | unsigned int total_bytes_received; | 114 | unsigned int total_bytes_received; |
115 | |||
116 | /** | ||
117 | * Logs for slaves | ||
118 | */ | ||
119 | struct PartnerLoggingTimestep *slaves_log; | ||
64 | }; | 120 | }; |
65 | 121 | ||
122 | /** | ||
123 | * Entry for a benchmark peer | ||
124 | */ | ||
66 | struct LoggingPeer | 125 | struct LoggingPeer |
67 | { | 126 | { |
127 | /** | ||
128 | * Peer | ||
129 | */ | ||
68 | struct BenchmarkPeer *peer; | 130 | struct BenchmarkPeer *peer; |
69 | 131 | ||
132 | /** | ||
133 | * Start time | ||
134 | */ | ||
70 | struct GNUNET_TIME_Absolute start; | 135 | struct GNUNET_TIME_Absolute start; |
71 | 136 | ||
72 | struct LoggingTimestep *head; | 137 | /** |
73 | struct LoggingTimestep *tail; | 138 | * DLL for logging entries: head |
139 | */ | ||
140 | struct PeerLoggingTimestep *head; | ||
141 | |||
142 | /** | ||
143 | * DLL for logging entries: tail | ||
144 | */ | ||
145 | struct PeerLoggingTimestep *tail; | ||
74 | }; | 146 | }; |
75 | 147 | ||
76 | /** | 148 | /** |
@@ -85,8 +157,9 @@ write_to_file () | |||
85 | struct GNUNET_DISK_FileHandle *f; | 157 | struct GNUNET_DISK_FileHandle *f; |
86 | char * filename; | 158 | char * filename; |
87 | char *data; | 159 | char *data; |
88 | struct LoggingTimestep *cur; | 160 | struct PeerLoggingTimestep *cur; |
89 | int c_m; | 161 | int c_m; |
162 | //int c_s; | ||
90 | unsigned int throughput_recv; | 163 | unsigned int throughput_recv; |
91 | unsigned int throughput_send; | 164 | unsigned int throughput_send; |
92 | double mult; | 165 | double mult; |
@@ -128,6 +201,8 @@ write_to_file () | |||
128 | cur->total_messages_sent, cur->total_bytes_sent, throughput_send, | 201 | cur->total_messages_sent, cur->total_bytes_sent, throughput_send, |
129 | cur->total_messages_received, cur->total_bytes_received, throughput_recv); | 202 | cur->total_messages_received, cur->total_bytes_received, throughput_recv); |
130 | 203 | ||
204 | // for () | ||
205 | |||
131 | GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u\n", | 206 | GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u\n", |
132 | cur->timestamp, | 207 | cur->timestamp, |
133 | GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur->timestamp).rel_value_us / 1000, | 208 | GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur->timestamp).rel_value_us / 1000, |
@@ -156,31 +231,40 @@ collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
156 | { | 231 | { |
157 | int c_m; | 232 | int c_m; |
158 | int c_s; | 233 | int c_s; |
159 | struct LoggingTimestep *lt; | 234 | struct PeerLoggingTimestep *mlt; |
235 | struct PartnerLoggingTimestep *slt; | ||
160 | struct BenchmarkPartner *p; | 236 | struct BenchmarkPartner *p; |
161 | 237 | ||
162 | log_task = GNUNET_SCHEDULER_NO_TASK; | 238 | log_task = GNUNET_SCHEDULER_NO_TASK; |
163 | 239 | ||
164 | for (c_m = 0; c_m < num_peers; c_m++) | 240 | for (c_m = 0; c_m < num_peers; c_m++) |
165 | { | 241 | { |
166 | lt = GNUNET_malloc (sizeof (struct LoggingTimestep)); | 242 | mlt = GNUNET_malloc (sizeof (struct PeerLoggingTimestep)); |
167 | GNUNET_CONTAINER_DLL_insert_tail(lp[c_m].head, lp[c_m].tail, lt); | 243 | GNUNET_CONTAINER_DLL_insert_tail(lp[c_m].head, lp[c_m].tail, mlt); |
168 | 244 | ||
169 | /* Collect data */ | 245 | /* Collect data */ |
170 | lt->timestamp = GNUNET_TIME_absolute_get(); | 246 | mlt->timestamp = GNUNET_TIME_absolute_get(); |
171 | lt->total_bytes_sent = lp[c_m].peer->total_bytes_sent; | 247 | mlt->total_bytes_sent = lp[c_m].peer->total_bytes_sent; |
172 | lt->total_messages_sent = lp[c_m].peer->total_messages_sent; | 248 | mlt->total_messages_sent = lp[c_m].peer->total_messages_sent; |
173 | lt->total_bytes_received = lp[c_m].peer->total_bytes_received; | 249 | mlt->total_bytes_received = lp[c_m].peer->total_bytes_received; |
174 | lt->total_messages_received = lp[c_m].peer->total_messages_received; | 250 | mlt->total_messages_received = lp[c_m].peer->total_messages_received; |
251 | |||
252 | mlt->slaves_log = GNUNET_malloc (lp[c_m].peer->num_partners * | ||
253 | sizeof (struct PartnerLoggingTimestep)); | ||
175 | 254 | ||
176 | for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++) | 255 | for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++) |
177 | { | 256 | { |
178 | p = &peers[c_m].partners[c_s]; | 257 | p = &lp[c_m].peer->partners[c_s]; |
179 | /* | 258 | slt = &mlt->slaves_log[c_s]; |
259 | slt->slave = p->dest; | ||
260 | slt->total_bytes_sent = p->dest->total_bytes_sent; | ||
261 | slt->total_messages_sent = p->dest->total_messages_sent; | ||
262 | slt->total_bytes_received = p->dest->total_bytes_received; | ||
263 | slt->total_messages_received = p->dest->total_messages_received; | ||
264 | |||
180 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 265 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
181 | "Master [%u]: slave [%u]\n", | 266 | "Master [%u]: slave [%u]\n", |
182 | lp->peer->no, p->dest->no); | 267 | lp->peer->no, p->dest->no); |
183 | */ | ||
184 | } | 268 | } |
185 | } | 269 | } |
186 | 270 | ||
@@ -197,7 +281,7 @@ perf_logging_stop () | |||
197 | { | 281 | { |
198 | int c_m; | 282 | int c_m; |
199 | struct GNUNET_SCHEDULER_TaskContext tc; | 283 | struct GNUNET_SCHEDULER_TaskContext tc; |
200 | struct LoggingTimestep *cur; | 284 | struct PeerLoggingTimestep *cur; |
201 | 285 | ||
202 | if (GNUNET_SCHEDULER_NO_TASK != log_task) | 286 | if (GNUNET_SCHEDULER_NO_TASK != log_task) |
203 | GNUNET_SCHEDULER_cancel (log_task); | 287 | GNUNET_SCHEDULER_cancel (log_task); |
@@ -215,6 +299,7 @@ perf_logging_stop () | |||
215 | while (NULL != (cur = lp[c_m].head)) | 299 | while (NULL != (cur = lp[c_m].head)) |
216 | { | 300 | { |
217 | GNUNET_CONTAINER_DLL_remove (lp[c_m].head, lp[c_m].tail, cur); | 301 | GNUNET_CONTAINER_DLL_remove (lp[c_m].head, lp[c_m].tail, cur); |
302 | GNUNET_free (cur->slaves_log); | ||
218 | GNUNET_free (cur); | 303 | GNUNET_free (cur); |
219 | } | 304 | } |
220 | } | 305 | } |
@@ -229,7 +314,6 @@ perf_logging_start (char * testname, struct BenchmarkPeer *masters, int num_mast | |||
229 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 314 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
230 | _("Start logging `%s'\n"), testname); | 315 | _("Start logging `%s'\n"), testname); |
231 | 316 | ||
232 | peers = masters; | ||
233 | num_peers = num_masters; | 317 | num_peers = num_masters; |
234 | name = testname; | 318 | name = testname; |
235 | 319 | ||