diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-20 16:34:23 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-20 16:34:23 +0000 |
commit | 3f049445d7adc952e05c002d8414a15d68046c8e (patch) | |
tree | e6e866f674d688fb76020d1b5f022fb7e424be6c /src/ats-tests/perf_ats_logging.c | |
parent | c2888c6fee538824dc1e176d5336c4bbd86314df (diff) | |
download | gnunet-3f049445d7adc952e05c002d8414a15d68046c8e.tar.gz gnunet-3f049445d7adc952e05c002d8414a15d68046c8e.zip |
implemented ATS perf info logging + push logging
issue: what to do if no values changed
Diffstat (limited to 'src/ats-tests/perf_ats_logging.c')
-rw-r--r-- | src/ats-tests/perf_ats_logging.c | 180 |
1 files changed, 102 insertions, 78 deletions
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c index ea51abae5..54e9f7fd9 100644 --- a/src/ats-tests/perf_ats_logging.c +++ b/src/ats-tests/perf_ats_logging.c | |||
@@ -99,11 +99,32 @@ struct PartnerLoggingTimestep | |||
99 | */ | 99 | */ |
100 | unsigned int total_app_rtt; | 100 | unsigned int total_app_rtt; |
101 | 101 | ||
102 | |||
103 | /** | 102 | /** |
104 | * Current application level delay | 103 | * Current application level delay |
105 | */ | 104 | */ |
106 | unsigned int app_rtt; | 105 | unsigned int app_rtt; |
106 | |||
107 | /* Current ATS properties */ | ||
108 | |||
109 | uint32_t ats_distance; | ||
110 | |||
111 | uint32_t ats_delay; | ||
112 | |||
113 | uint32_t bandwidth_in; | ||
114 | |||
115 | uint32_t bandwidth_out; | ||
116 | |||
117 | uint32_t ats_utilization_up; | ||
118 | |||
119 | uint32_t ats_utilization_down; | ||
120 | |||
121 | uint32_t ats_network_type; | ||
122 | |||
123 | uint32_t ats_cost_wan; | ||
124 | |||
125 | uint32_t ats_cost_lan; | ||
126 | |||
127 | uint32_t ats_cost_wlan; | ||
107 | }; | 128 | }; |
108 | 129 | ||
109 | 130 | ||
@@ -292,6 +313,7 @@ static void | |||
292 | write_to_file () | 313 | write_to_file () |
293 | { | 314 | { |
294 | struct GNUNET_DISK_FileHandle *f; | 315 | struct GNUNET_DISK_FileHandle *f; |
316 | struct GNUNET_TIME_Relative delta; | ||
295 | char * filename; | 317 | char * filename; |
296 | char *data; | 318 | char *data; |
297 | char *slave_string; | 319 | char *slave_string; |
@@ -324,7 +346,15 @@ write_to_file () | |||
324 | 346 | ||
325 | for (cur_lt = lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next) | 347 | for (cur_lt = lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next) |
326 | { | 348 | { |
327 | mult = (1.0 * 1000 * 1000) / (LOGGING_FREQUENCY.rel_value_us); | 349 | if (NULL == cur_lt->prev) |
350 | { | ||
351 | delta = GNUNET_TIME_absolute_get_difference (lp[c_m].start, cur_lt->timestamp); | ||
352 | } | ||
353 | else | ||
354 | delta = GNUNET_TIME_absolute_get_difference (cur_lt->prev->timestamp, cur_lt->timestamp); | ||
355 | |||
356 | /* Multiplication factor for throughput calculation */ | ||
357 | mult = (1.0 * 1000 * 1000) / (delta.rel_value_us); | ||
328 | if (NULL != cur_lt->prev) | 358 | if (NULL != cur_lt->prev) |
329 | { | 359 | { |
330 | throughput_send = cur_lt->total_bytes_sent - cur_lt->prev->total_bytes_sent; | 360 | throughput_send = cur_lt->total_bytes_sent - cur_lt->prev->total_bytes_sent; |
@@ -364,9 +394,10 @@ write_to_file () | |||
364 | throughput_recv_slave *= mult; | 394 | throughput_recv_slave *= mult; |
365 | /* Assembling slave string */ | 395 | /* Assembling slave string */ |
366 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 396 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
367 | "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u \n", plt->slave->no, | 397 | "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u \n", plt->slave->no, |
368 | plt->total_messages_sent, plt->total_bytes_sent, throughput_send_slave, | 398 | plt->total_messages_sent, plt->total_bytes_sent, throughput_send_slave, |
369 | plt->total_messages_received, plt->total_bytes_received, throughput_recv_slave, plt->app_rtt); | 399 | plt->total_messages_received, plt->total_bytes_received, throughput_recv_slave, |
400 | plt->app_rtt, plt->ats_delay); | ||
370 | 401 | ||
371 | 402 | ||
372 | GNUNET_asprintf(&slave_string_tmp, "%s%u;%u;%u;%u;%u;%u;%.3f;",slave_string, | 403 | GNUNET_asprintf(&slave_string_tmp, "%s%u;%u;%u;%u;%u;%u;%.3f;",slave_string, |
@@ -405,103 +436,96 @@ write_to_file () | |||
405 | } | 436 | } |
406 | 437 | ||
407 | 438 | ||
408 | static void | 439 | void |
409 | collect_log_now (struct LoggingPeer *bp) | 440 | collect_log_now (void) |
410 | { | 441 | { |
442 | struct LoggingPeer *bp; | ||
411 | struct PeerLoggingTimestep *mlt; | 443 | struct PeerLoggingTimestep *mlt; |
412 | struct PartnerLoggingTimestep *slt; | 444 | struct PartnerLoggingTimestep *slt; |
413 | struct PartnerLoggingTimestep *prev_log_slt; | 445 | struct PartnerLoggingTimestep *prev_log_slt; |
414 | struct BenchmarkPartner *p; | 446 | struct BenchmarkPartner *p; |
415 | int c_s; | 447 | int c_s; |
448 | int c_m; | ||
416 | unsigned int app_rtt; | 449 | unsigned int app_rtt; |
417 | 450 | ||
418 | mlt = GNUNET_malloc (sizeof (struct PeerLoggingTimestep)); | 451 | if (GNUNET_YES != running) |
419 | GNUNET_CONTAINER_DLL_insert_tail(bp->head, bp->tail, mlt); | 452 | return; |
453 | |||
454 | for (c_m = 0; c_m < num_peers; c_m++) | ||
455 | { | ||
456 | bp = &lp[c_m]; | ||
457 | mlt = GNUNET_malloc (sizeof (struct PeerLoggingTimestep)); | ||
458 | GNUNET_CONTAINER_DLL_insert_tail(bp->head, bp->tail, mlt); | ||
420 | 459 | ||
421 | /* Collect data */ | 460 | /* Collect data */ |
422 | 461 | ||
423 | /* Current master state */ | 462 | /* Current master state */ |
424 | mlt->timestamp = GNUNET_TIME_absolute_get(); | 463 | mlt->timestamp = GNUNET_TIME_absolute_get(); |
425 | mlt->total_bytes_sent = bp->peer->total_bytes_sent; | 464 | mlt->total_bytes_sent = bp->peer->total_bytes_sent; |
426 | mlt->total_messages_sent = bp->peer->total_messages_sent; | 465 | mlt->total_messages_sent = bp->peer->total_messages_sent; |
427 | mlt->total_bytes_received = bp->peer->total_bytes_received; | 466 | mlt->total_bytes_received = bp->peer->total_bytes_received; |
428 | mlt->total_messages_received = bp->peer->total_messages_received; | 467 | mlt->total_messages_received = bp->peer->total_messages_received; |
429 | 468 | ||
430 | mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners * | 469 | mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners * |
431 | sizeof (struct PartnerLoggingTimestep)); | 470 | sizeof (struct PartnerLoggingTimestep)); |
432 | 471 | ||
433 | for (c_s = 0; c_s < bp->peer->num_partners; c_s++) | 472 | for (c_s = 0; c_s < bp->peer->num_partners; c_s++) |
434 | { | ||
435 | p = &bp->peer->partners[c_s]; | ||
436 | slt = &mlt->slaves_log[c_s]; | ||
437 | |||
438 | slt->slave = p->dest; | ||
439 | /* Bytes sent from master to this slave */ | ||
440 | slt->total_bytes_sent = p->bytes_sent; | ||
441 | /* Messages sent from master to this slave */ | ||
442 | slt->total_messages_sent = p->messages_sent; | ||
443 | /* Bytes master received from this slave */ | ||
444 | slt->total_bytes_received = p->bytes_received; | ||
445 | /* Messages master received from this slave */ | ||
446 | slt->total_messages_received = p->messages_received; | ||
447 | slt->total_app_rtt = p->total_app_rtt; | ||
448 | |||
449 | /* Total application level rtt */ | ||
450 | /* | ||
451 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | ||
452 | "Master [%u]: slave [%u]: partner total rtt %u / %u = %u\n", | ||
453 | bp->peer->no, p->dest->no, | ||
454 | p->total_app_rtt, p->messages_sent, (p->messages_sent != 0)?p->total_app_rtt / p->messages_sent : 0); | ||
455 | */ | ||
456 | if (NULL == mlt->prev) | ||
457 | { | 473 | { |
458 | if (0 != slt->total_messages_sent) | 474 | p = &bp->peer->partners[c_s]; |
459 | app_rtt = slt->total_app_rtt / slt->total_messages_sent; | 475 | slt = &mlt->slaves_log[c_s]; |
476 | |||
477 | slt->slave = p->dest; | ||
478 | /* Bytes sent from master to this slave */ | ||
479 | slt->total_bytes_sent = p->bytes_sent; | ||
480 | /* Messages sent from master to this slave */ | ||
481 | slt->total_messages_sent = p->messages_sent; | ||
482 | /* Bytes master received from this slave */ | ||
483 | slt->total_bytes_received = p->bytes_received; | ||
484 | /* Messages master received from this slave */ | ||
485 | slt->total_messages_received = p->messages_received; | ||
486 | slt->total_app_rtt = p->total_app_rtt; | ||
487 | /* ats performance information */ | ||
488 | slt->ats_cost_lan = p->ats_cost_lan; | ||
489 | slt->ats_cost_wan = p->ats_cost_wan; | ||
490 | slt->ats_cost_wlan = p->ats_cost_wlan; | ||
491 | slt->ats_delay = p->ats_delay; | ||
492 | slt->ats_distance = p->ats_distance; | ||
493 | slt->ats_network_type = p->ats_network_type; | ||
494 | slt->ats_utilization_down = p->ats_utilization_down; | ||
495 | slt->ats_utilization_up = p->ats_utilization_up; | ||
496 | |||
497 | |||
498 | /* Total application level rtt */ | ||
499 | if (NULL == mlt->prev) | ||
500 | { | ||
501 | if (0 != slt->total_messages_sent) | ||
502 | app_rtt = slt->total_app_rtt / slt->total_messages_sent; | ||
503 | else | ||
504 | app_rtt = 0; | ||
505 | } | ||
460 | else | 506 | else |
461 | app_rtt = 0; | 507 | { |
462 | } | 508 | prev_log_slt = &mlt->prev->slaves_log[c_s]; |
463 | else | 509 | if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0) |
464 | { | 510 | app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt) / |
465 | prev_log_slt = &mlt->prev->slaves_log[c_s]; | 511 | (slt->total_messages_sent - prev_log_slt->total_messages_sent); |
466 | /* | 512 | else |
467 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 513 | app_rtt = 0; |
468 | "Master [%u]: slave [%u]: %u - %u = %u ..... delta messages %u - %u = %u \n", | 514 | } |
469 | bp->peer->no, p->dest->no, | 515 | slt->app_rtt = app_rtt; |
470 | slt->total_app_rtt, prev_log_slt->total_app_rtt, slt->total_app_rtt - prev_log_slt->total_app_rtt, | 516 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
471 | slt->total_messages_sent, prev_log_slt->total_messages_sent, slt->total_messages_sent - prev_log_slt->total_messages_sent | 517 | "Master [%u]: slave [%u]\n", |
472 | ); | 518 | bp->peer->no, p->dest->no); |
473 | */ | ||
474 | |||
475 | app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt) / | ||
476 | (slt->total_messages_sent - prev_log_slt->total_messages_sent); | ||
477 | |||
478 | } | 519 | } |
479 | |||
480 | |||
481 | /* | ||
482 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | ||
483 | "Master [%u]: slave [%u]: %u \ncurrent total rtt %u previous total rtt %u delta total rtt %u\n", | ||
484 | bp->peer->no, p->dest->no, | ||
485 | p->total_app_rtt, | ||
486 | slt->total_app_rtt, prev_log_slt->total_app_rtt, (slt->total_app_rtt - prev_log_slt->total_app_rtt) , | ||
487 | app_rtt);*/ | ||
488 | slt->app_rtt = app_rtt; | ||
489 | |||
490 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
491 | "Master [%u]: slave [%u]\n", | ||
492 | bp->peer->no, p->dest->no); | ||
493 | } | 520 | } |
494 | } | 521 | } |
495 | 522 | ||
496 | static void | 523 | static void |
497 | collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 524 | collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
498 | { | 525 | { |
499 | int c_m; | ||
500 | |||
501 | log_task = GNUNET_SCHEDULER_NO_TASK; | 526 | log_task = GNUNET_SCHEDULER_NO_TASK; |
502 | 527 | ||
503 | for (c_m = 0; c_m < num_peers; c_m++) | 528 | collect_log_now(); |
504 | collect_log_now (&lp[c_m]); | ||
505 | 529 | ||
506 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) | 530 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) |
507 | return; | 531 | return; |