aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tests/perf_ats_logging.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-09-20 08:35:11 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-09-20 08:35:11 +0000
commitafa377f3c8aee8c10433629d8273850b650bd90a (patch)
treeda0dee8f7e92bb3476ae4bfec91aaf59ee896745 /src/ats-tests/perf_ats_logging.c
parentd6b447eb42ce0a45d210d35007d330d21448586f (diff)
downloadgnunet-afa377f3c8aee8c10433629d8273850b650bd90a.tar.gz
gnunet-afa377f3c8aee8c10433629d8273850b650bd90a.zip
logging changes
Diffstat (limited to 'src/ats-tests/perf_ats_logging.c')
-rw-r--r--src/ats-tests/perf_ats_logging.c84
1 files changed, 49 insertions, 35 deletions
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c
index 592c1070f..6c68ce0fc 100644
--- a/src/ats-tests/perf_ats_logging.c
+++ b/src/ats-tests/perf_ats_logging.c
@@ -29,7 +29,7 @@
29 29
30#define THROUGHPUT_TEMPLATE "#!/usr/bin/gnuplot \n" \ 30#define THROUGHPUT_TEMPLATE "#!/usr/bin/gnuplot \n" \
31"set datafile separator ';' \n" \ 31"set datafile separator ';' \n" \
32"set title \"Throughput\" \n" \ 32"set title \"Throughput between Master and Slaves\" \n" \
33"set xlabel \"Time in ms\" \n" \ 33"set xlabel \"Time in ms\" \n" \
34"set ylabel \"Bytes/s\" \n" 34"set ylabel \"Bytes/s\" \n"
35 35
@@ -182,8 +182,8 @@ write_gnuplot_script (char * fn, struct LoggingPeer *lp)
182 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); 182 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn);
183 183
184 /* Write master data */ 184 /* Write master data */
185 GNUNET_asprintf (&data, "plot '%s' using 2:%u with lines title 'Master %u send', \\\n" \ 185 GNUNET_asprintf (&data, "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \
186 "'%s' using 2:%u with lines title 'Master %u receive', \\\n", 186 "'%s' using 2:%u with lines title 'Master %u receive total', \\\n",
187 fn, 5, lp->peer->no, 187 fn, 5, lp->peer->no,
188 fn, 8, lp->peer->no); 188 fn, 8, lp->peer->no);
189 if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) 189 if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
@@ -193,8 +193,8 @@ write_gnuplot_script (char * fn, struct LoggingPeer *lp)
193 index = 11; 193 index = 11;
194 for (c_s = 0; c_s < lp->peer->num_partners; c_s++) 194 for (c_s = 0; c_s < lp->peer->num_partners; c_s++)
195 { 195 {
196 GNUNET_asprintf (&data, "'%s' using 2:%u with lines title 'Slave %u send', \\\n" \ 196 GNUNET_asprintf (&data, "'%s' using 2:%u with lines title 'Master - Slave %u send', \\\n" \
197 "'%s' using 2:%u with lines title 'Slave %u receive'%s\n", 197 "'%s' using 2:%u with lines title 'Master - Slave %u receive'%s\n",
198 fn, index, lp->peer->no, 198 fn, index, lp->peer->no,
199 fn, index+3, lp->peer->no, 199 fn, index+3, lp->peer->no,
200 (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); 200 (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1");
@@ -324,47 +324,61 @@ write_to_file ()
324 } 324 }
325} 325}
326 326
327
327static void 328static void
328collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 329collect_log_now (struct LoggingPeer *bp)
329{ 330{
330 int c_m;
331 int c_s;
332 struct PeerLoggingTimestep *mlt; 331 struct PeerLoggingTimestep *mlt;
333 struct PartnerLoggingTimestep *slt; 332 struct PartnerLoggingTimestep *slt;
334 struct BenchmarkPartner *p; 333 struct BenchmarkPartner *p;
334 int c_s;
335 335
336 log_task = GNUNET_SCHEDULER_NO_TASK; 336 mlt = GNUNET_malloc (sizeof (struct PeerLoggingTimestep));
337 GNUNET_CONTAINER_DLL_insert_tail(bp->head, bp->tail, mlt);
337 338
338 for (c_m = 0; c_m < num_peers; c_m++) 339 /* Collect data */
339 {
340 mlt = GNUNET_malloc (sizeof (struct PeerLoggingTimestep));
341 GNUNET_CONTAINER_DLL_insert_tail(lp[c_m].head, lp[c_m].tail, mlt);
342 340
343 /* Collect data */ 341 /* Current master state */
344 mlt->timestamp = GNUNET_TIME_absolute_get(); 342 mlt->timestamp = GNUNET_TIME_absolute_get();
345 mlt->total_bytes_sent = lp[c_m].peer->total_bytes_sent; 343 mlt->total_bytes_sent = bp->peer->total_bytes_sent;
346 mlt->total_messages_sent = lp[c_m].peer->total_messages_sent; 344 mlt->total_messages_sent = bp->peer->total_messages_sent;
347 mlt->total_bytes_received = lp[c_m].peer->total_bytes_received; 345 mlt->total_bytes_received = bp->peer->total_bytes_received;
348 mlt->total_messages_received = lp[c_m].peer->total_messages_received; 346 mlt->total_messages_received = bp->peer->total_messages_received;
349 347
350 mlt->slaves_log = GNUNET_malloc (lp[c_m].peer->num_partners * 348 mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners *
351 sizeof (struct PartnerLoggingTimestep)); 349 sizeof (struct PartnerLoggingTimestep));
352 350
353 for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++) 351 for (c_s = 0; c_s < bp->peer->num_partners; c_s++)
354 { 352 {
355 p = &lp[c_m].peer->partners[c_s]; 353 p = &bp->peer->partners[c_s];
356 slt = &mlt->slaves_log[c_s]; 354 slt = &mlt->slaves_log[c_s];
357 slt->slave = p->dest; 355 slt->slave = p->dest;
358 slt->total_bytes_sent = p->dest->total_bytes_sent; 356 /* Bytes sent from master to this slave */
359 slt->total_messages_sent = p->dest->total_messages_sent; 357 slt->total_bytes_sent = p->bytes_sent;
360 slt->total_bytes_received = p->dest->total_bytes_received; 358 /* Messages sent from master to this slave */
361 slt->total_messages_received = p->dest->total_messages_received; 359 slt->total_messages_sent = p->messages_sent;
362 360 /* Bytes master received from this slave */
363 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 361 slt->total_bytes_received = p->bytes_received;
364 "Master [%u]: slave [%u]\n", 362 /* Messages master received from this slave */
365 lp[c_m].peer->no, p->dest->no); 363 slt->total_messages_received = p->messages_received;
366 } 364
365
366
367 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
368 "Master [%u]: slave [%u]\n",
369 bp->peer->no, p->dest->no);
367 } 370 }
371}
372
373static void
374collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
375{
376 int c_m;
377
378 log_task = GNUNET_SCHEDULER_NO_TASK;
379
380 for (c_m = 0; c_m < num_peers; c_m++)
381 collect_log_now (&lp[c_m]);
368 382
369 if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) 383 if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
370 return; 384 return;