diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-21 21:48:59 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-21 21:48:59 +0000 |
commit | f7ab01ca8f81b40e8a8ea2992bdaf6cad772554f (patch) | |
tree | d0335376cd98f433c94248078b50b6e7bee61106 /src/ats-tests/perf_ats_logging.c | |
parent | 3770eff61976eb1befadf76b6a8a9d2f3da80762 (diff) | |
download | gnunet-f7ab01ca8f81b40e8a8ea2992bdaf6cad772554f.tar.gz gnunet-f7ab01ca8f81b40e8a8ea2992bdaf6cad772554f.zip |
improved logging
Diffstat (limited to 'src/ats-tests/perf_ats_logging.c')
-rw-r--r-- | src/ats-tests/perf_ats_logging.c | 174 |
1 files changed, 93 insertions, 81 deletions
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c index 213958e6b..56d00b997 100644 --- a/src/ats-tests/perf_ats_logging.c +++ b/src/ats-tests/perf_ats_logging.c | |||
@@ -95,6 +95,16 @@ struct PartnerLoggingTimestep | |||
95 | unsigned int total_bytes_received; | 95 | unsigned int total_bytes_received; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Total outbound throughput for master in Bytes / s | ||
99 | */ | ||
100 | unsigned int throughput_sent; | ||
101 | |||
102 | /** | ||
103 | * Total inbound throughput for master in Bytes / s | ||
104 | */ | ||
105 | unsigned int throughput_recv; | ||
106 | |||
107 | /** | ||
98 | * Accumulated RTT for all messages | 108 | * Accumulated RTT for all messages |
99 | */ | 109 | */ |
100 | unsigned int total_app_rtt; | 110 | unsigned int total_app_rtt; |
@@ -169,6 +179,16 @@ struct PeerLoggingTimestep | |||
169 | unsigned int total_bytes_received; | 179 | unsigned int total_bytes_received; |
170 | 180 | ||
171 | /** | 181 | /** |
182 | * Total outbound throughput for master in Bytes / s | ||
183 | */ | ||
184 | unsigned int total_throughput_send; | ||
185 | |||
186 | /** | ||
187 | * Total inbound throughput for master in Bytes / s | ||
188 | */ | ||
189 | unsigned int total_throughput_recv; | ||
190 | |||
191 | /** | ||
172 | * Logs for slaves | 192 | * Logs for slaves |
173 | */ | 193 | */ |
174 | struct PartnerLoggingTimestep *slaves_log; | 194 | struct PartnerLoggingTimestep *slaves_log; |
@@ -313,7 +333,7 @@ static void | |||
313 | write_to_file () | 333 | write_to_file () |
314 | { | 334 | { |
315 | struct GNUNET_DISK_FileHandle *f; | 335 | struct GNUNET_DISK_FileHandle *f; |
316 | struct GNUNET_TIME_Relative delta; | 336 | |
317 | char * filename; | 337 | char * filename; |
318 | char *data; | 338 | char *data; |
319 | char *slave_string; | 339 | char *slave_string; |
@@ -322,13 +342,6 @@ write_to_file () | |||
322 | struct PartnerLoggingTimestep *plt; | 342 | struct PartnerLoggingTimestep *plt; |
323 | int c_m; | 343 | int c_m; |
324 | int c_s; | 344 | int c_s; |
325 | unsigned int throughput_recv; | ||
326 | unsigned int throughput_send; | ||
327 | unsigned int throughput_recv_slave; | ||
328 | unsigned int throughput_send_slave; | ||
329 | int last_throughput_send; | ||
330 | int last_throughput_recv; | ||
331 | double mult; | ||
332 | 345 | ||
333 | for (c_m = 0; c_m < num_peers; c_m++) | 346 | for (c_m = 0; c_m < num_peers; c_m++) |
334 | { | 347 | { |
@@ -345,91 +358,31 @@ write_to_file () | |||
345 | return; | 358 | return; |
346 | } | 359 | } |
347 | 360 | ||
348 | last_throughput_recv = 0; | ||
349 | last_throughput_send = 0; | ||
350 | |||
351 | for (cur_lt = lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next) | 361 | for (cur_lt = lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next) |
352 | { | 362 | { |
353 | if (NULL == cur_lt->prev) | 363 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
354 | { | ||
355 | delta = GNUNET_TIME_absolute_get_difference (lp[c_m].start, cur_lt->timestamp); | ||
356 | } | ||
357 | else | ||
358 | delta = GNUNET_TIME_absolute_get_difference (cur_lt->prev->timestamp, cur_lt->timestamp); | ||
359 | |||
360 | /* Multiplication factor for throughput calculation */ | ||
361 | mult = (1.0 * 1000 * 1000) / (delta.rel_value_us); | ||
362 | if (NULL != cur_lt->prev) | ||
363 | { | ||
364 | if (cur_lt->total_bytes_sent - cur_lt->prev->total_bytes_sent > 0) | ||
365 | { | ||
366 | throughput_send = cur_lt->total_bytes_sent - cur_lt->prev->total_bytes_sent; | ||
367 | throughput_send *= mult; | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | //GNUNET_break (0); | ||
372 | throughput_send = last_throughput_send; /* no msgs received */ | ||
373 | } | ||
374 | |||
375 | if (cur_lt->total_bytes_received - cur_lt->prev->total_bytes_received > 0) | ||
376 | { | ||
377 | throughput_recv = cur_lt->total_bytes_received - cur_lt->prev->total_bytes_received; | ||
378 | throughput_recv *= mult; | ||
379 | } | ||
380 | else | ||
381 | { | ||
382 | // GNUNET_break (0); | ||
383 | throughput_recv = last_throughput_recv; /* no msgs received */ | ||
384 | } | ||
385 | } | ||
386 | else | ||
387 | { | ||
388 | throughput_send = cur_lt->total_bytes_sent; | ||
389 | throughput_recv = cur_lt->total_bytes_received; | ||
390 | |||
391 | throughput_send *= mult; | ||
392 | throughput_recv *= mult; | ||
393 | |||
394 | } | ||
395 | last_throughput_send = throughput_send; | ||
396 | last_throughput_recv = throughput_recv; | ||
397 | |||
398 | |||
399 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
400 | "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n", lp[c_m].peer->no, | 364 | "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n", lp[c_m].peer->no, |
401 | cur_lt->timestamp, GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, | 365 | cur_lt->timestamp, GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, |
402 | cur_lt->total_messages_sent, cur_lt->total_bytes_sent, throughput_send, | 366 | cur_lt->total_messages_sent, cur_lt->total_bytes_sent, cur_lt->total_throughput_send, |
403 | cur_lt->total_messages_received, cur_lt->total_bytes_received, throughput_recv); | 367 | cur_lt->total_messages_received, cur_lt->total_bytes_received, cur_lt->total_throughput_recv); |
404 | 368 | ||
405 | slave_string = GNUNET_strdup (";"); | 369 | slave_string = GNUNET_strdup (";"); |
406 | for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++) | 370 | for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++) |
407 | { | 371 | { |
408 | /* Log partners */ | ||
409 | plt = &cur_lt->slaves_log[c_s]; | 372 | plt = &cur_lt->slaves_log[c_s]; |
410 | if (NULL != cur_lt->prev) | 373 | /* Log partners */ |
411 | { | 374 | |
412 | throughput_send_slave = plt->total_bytes_sent - cur_lt->prev->slaves_log[c_s].total_bytes_sent; | ||
413 | throughput_recv_slave = plt->total_bytes_received - cur_lt->prev->slaves_log[c_s].total_bytes_received; | ||
414 | } | ||
415 | else | ||
416 | { | ||
417 | throughput_send_slave = plt->total_bytes_sent; | ||
418 | throughput_recv_slave = plt->total_bytes_received; | ||
419 | } | ||
420 | throughput_send_slave *= mult; | ||
421 | throughput_recv_slave *= mult; | ||
422 | /* Assembling slave string */ | 375 | /* Assembling slave string */ |
423 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 376 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
424 | "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u \n", plt->slave->no, | 377 | "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u \n", plt->slave->no, |
425 | plt->total_messages_sent, plt->total_bytes_sent, throughput_send_slave, | 378 | plt->total_messages_sent, plt->total_bytes_sent, plt->throughput_sent, |
426 | plt->total_messages_received, plt->total_bytes_received, throughput_recv_slave, | 379 | plt->total_messages_received, plt->total_bytes_received, plt->throughput_recv, |
427 | plt->app_rtt, plt->ats_delay); | 380 | plt->app_rtt, plt->ats_delay); |
428 | 381 | ||
429 | 382 | ||
430 | GNUNET_asprintf(&slave_string_tmp, "%s%u;%u;%u;%u;%u;%u;%.3f;",slave_string, | 383 | GNUNET_asprintf(&slave_string_tmp, "%s%u;%u;%u;%u;%u;%u;%.3f;",slave_string, |
431 | plt->total_messages_sent, plt->total_bytes_sent, throughput_send_slave, | 384 | plt->total_messages_sent, plt->total_bytes_sent, plt->throughput_sent, |
432 | plt->total_messages_received, plt->total_bytes_received, throughput_recv_slave, | 385 | plt->total_messages_received, plt->total_bytes_received, plt->throughput_sent, |
433 | (double) plt->app_rtt / 1000); | 386 | (double) plt->app_rtt / 1000); |
434 | GNUNET_free (slave_string); | 387 | GNUNET_free (slave_string); |
435 | slave_string = slave_string_tmp; | 388 | slave_string = slave_string_tmp; |
@@ -438,8 +391,8 @@ write_to_file () | |||
438 | GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;%s\n", | 391 | GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;%s\n", |
439 | cur_lt->timestamp, | 392 | cur_lt->timestamp, |
440 | GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, | 393 | GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, |
441 | cur_lt->total_messages_sent, cur_lt->total_bytes_sent, throughput_send, | 394 | cur_lt->total_messages_sent, cur_lt->total_bytes_sent, cur_lt->total_throughput_send, |
442 | cur_lt->total_messages_received, cur_lt->total_bytes_received, throughput_recv, | 395 | cur_lt->total_messages_received, cur_lt->total_bytes_received, cur_lt->total_throughput_recv, |
443 | slave_string); | 396 | slave_string); |
444 | GNUNET_free (slave_string); | 397 | GNUNET_free (slave_string); |
445 | 398 | ||
@@ -468,12 +421,15 @@ collect_log_now (void) | |||
468 | { | 421 | { |
469 | struct LoggingPeer *bp; | 422 | struct LoggingPeer *bp; |
470 | struct PeerLoggingTimestep *mlt; | 423 | struct PeerLoggingTimestep *mlt; |
424 | struct PeerLoggingTimestep *prev_log_mlt; | ||
471 | struct PartnerLoggingTimestep *slt; | 425 | struct PartnerLoggingTimestep *slt; |
472 | struct PartnerLoggingTimestep *prev_log_slt; | 426 | struct PartnerLoggingTimestep *prev_log_slt; |
473 | struct BenchmarkPartner *p; | 427 | struct BenchmarkPartner *p; |
428 | struct GNUNET_TIME_Relative delta; | ||
474 | int c_s; | 429 | int c_s; |
475 | int c_m; | 430 | int c_m; |
476 | unsigned int app_rtt; | 431 | unsigned int app_rtt; |
432 | double mult; | ||
477 | 433 | ||
478 | if (GNUNET_YES != running) | 434 | if (GNUNET_YES != running) |
479 | return; | 435 | return; |
@@ -483,6 +439,7 @@ collect_log_now (void) | |||
483 | bp = &lp[c_m]; | 439 | bp = &lp[c_m]; |
484 | mlt = GNUNET_malloc (sizeof (struct PeerLoggingTimestep)); | 440 | mlt = GNUNET_malloc (sizeof (struct PeerLoggingTimestep)); |
485 | GNUNET_CONTAINER_DLL_insert_tail(bp->head, bp->tail, mlt); | 441 | GNUNET_CONTAINER_DLL_insert_tail(bp->head, bp->tail, mlt); |
442 | prev_log_mlt = mlt->prev; | ||
486 | 443 | ||
487 | /* Collect data */ | 444 | /* Collect data */ |
488 | 445 | ||
@@ -493,6 +450,40 @@ collect_log_now (void) | |||
493 | mlt->total_bytes_received = bp->peer->total_bytes_received; | 450 | mlt->total_bytes_received = bp->peer->total_bytes_received; |
494 | mlt->total_messages_received = bp->peer->total_messages_received; | 451 | mlt->total_messages_received = bp->peer->total_messages_received; |
495 | 452 | ||
453 | /* Throughput */ | ||
454 | if (NULL == prev_log_mlt) | ||
455 | { | ||
456 | /* Get difference to start */ | ||
457 | delta = GNUNET_TIME_absolute_get_difference (lp[c_m].start, mlt->timestamp); | ||
458 | } | ||
459 | else | ||
460 | { | ||
461 | /* Get difference to last timestep */ | ||
462 | delta = GNUNET_TIME_absolute_get_difference (mlt->prev->timestamp, mlt->timestamp); | ||
463 | } | ||
464 | |||
465 | /* Multiplication factor for throughput calculation */ | ||
466 | mult = (1.0 * 1000 * 1000) / (delta.rel_value_us); | ||
467 | |||
468 | /* Total throughput */ | ||
469 | if (NULL != prev_log_mlt) | ||
470 | { | ||
471 | if (mlt->total_bytes_sent - mlt->prev->total_bytes_sent > 0) | ||
472 | mlt->total_throughput_send = mult * (mlt->total_bytes_sent - mlt->prev->total_bytes_sent); | ||
473 | else | ||
474 | mlt->total_throughput_send = prev_log_mlt->total_throughput_send; /* no msgs send */ | ||
475 | |||
476 | if (mlt->total_bytes_received - mlt->prev->total_bytes_received > 0) | ||
477 | mlt->total_throughput_recv = mult * (mlt->total_bytes_received - mlt->prev->total_bytes_received); | ||
478 | else | ||
479 | mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */ | ||
480 | } | ||
481 | else | ||
482 | { | ||
483 | mlt->total_throughput_send = mult * mlt->total_bytes_sent; | ||
484 | mlt->total_throughput_send = mult * mlt->total_bytes_received; | ||
485 | } | ||
486 | |||
496 | mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners * | 487 | mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners * |
497 | sizeof (struct PartnerLoggingTimestep)); | 488 | sizeof (struct PartnerLoggingTimestep)); |
498 | 489 | ||
@@ -522,7 +513,7 @@ collect_log_now (void) | |||
522 | slt->ats_utilization_up = p->ats_utilization_up; | 513 | slt->ats_utilization_up = p->ats_utilization_up; |
523 | 514 | ||
524 | /* Total application level rtt */ | 515 | /* Total application level rtt */ |
525 | if (NULL == mlt->prev) | 516 | if (NULL == prev_log_mlt) |
526 | { | 517 | { |
527 | if (0 != slt->total_messages_sent) | 518 | if (0 != slt->total_messages_sent) |
528 | app_rtt = slt->total_app_rtt / slt->total_messages_sent; | 519 | app_rtt = slt->total_app_rtt / slt->total_messages_sent; |
@@ -531,7 +522,7 @@ collect_log_now (void) | |||
531 | } | 522 | } |
532 | else | 523 | else |
533 | { | 524 | { |
534 | prev_log_slt = &mlt->prev->slaves_log[c_s]; | 525 | prev_log_slt = &prev_log_mlt->slaves_log[c_s]; |
535 | if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0) | 526 | if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0) |
536 | app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt) / | 527 | app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt) / |
537 | (slt->total_messages_sent - prev_log_slt->total_messages_sent); | 528 | (slt->total_messages_sent - prev_log_slt->total_messages_sent); |
@@ -539,6 +530,27 @@ collect_log_now (void) | |||
539 | app_rtt = prev_log_slt->app_rtt; /* No messages were */ | 530 | app_rtt = prev_log_slt->app_rtt; /* No messages were */ |
540 | } | 531 | } |
541 | slt->app_rtt = app_rtt; | 532 | slt->app_rtt = app_rtt; |
533 | |||
534 | /* Partner throughput */ | ||
535 | if (NULL != prev_log_mlt) | ||
536 | { | ||
537 | prev_log_slt = &prev_log_mlt->slaves_log[c_s]; | ||
538 | if (slt->total_bytes_sent - prev_log_slt->total_bytes_sent > 0) | ||
539 | slt->throughput_sent = mult * (slt->total_bytes_sent - prev_log_slt->total_bytes_sent); | ||
540 | else | ||
541 | slt->throughput_sent = prev_log_slt->throughput_sent; /* no msgs send */ | ||
542 | |||
543 | if (slt->total_bytes_received - prev_log_slt->total_bytes_received > 0) | ||
544 | slt->throughput_recv = mult * (slt->total_bytes_received - prev_log_slt->total_bytes_received); | ||
545 | else | ||
546 | slt->throughput_recv = prev_log_slt->throughput_recv; /* no msgs received */ | ||
547 | } | ||
548 | else | ||
549 | { | ||
550 | slt->throughput_sent = mult * slt->total_bytes_sent; | ||
551 | slt->throughput_sent = mult * slt->total_bytes_received; | ||
552 | } | ||
553 | |||
542 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 554 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
543 | "Master [%u]: slave [%u]\n", | 555 | "Master [%u]: slave [%u]\n", |
544 | bp->peer->no, p->dest->no); | 556 | bp->peer->no, p->dest->no); |