diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-21 22:34:00 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-21 22:34:00 +0000 |
commit | ba82ebfcbd8de0ea2fac221247bf3fdbc543bfeb (patch) | |
tree | cae73806fc90757047cd3a005d01f18adc8623b4 /src/ats-tests/perf_ats_logging.c | |
parent | f7ab01ca8f81b40e8a8ea2992bdaf6cad772554f (diff) | |
download | gnunet-ba82ebfcbd8de0ea2fac221247bf3fdbc543bfeb.tar.gz gnunet-ba82ebfcbd8de0ea2fac221247bf3fdbc543bfeb.zip |
bandwidth gnuplot
Diffstat (limited to 'src/ats-tests/perf_ats_logging.c')
-rw-r--r-- | src/ats-tests/perf_ats_logging.c | 124 |
1 files changed, 101 insertions, 23 deletions
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c index 56d00b997..6dc5a96b4 100644 --- a/src/ats-tests/perf_ats_logging.c +++ b/src/ats-tests/perf_ats_logging.c | |||
@@ -31,25 +31,43 @@ | |||
31 | "set datafile separator ';' \n" \ | 31 | "set datafile separator ';' \n" \ |
32 | "set title \"Throughput between Master and Slaves\" \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 | "set grid \n" | ||
35 | 36 | ||
36 | #define RTT_TEMPLATE "#!/usr/bin/gnuplot \n" \ | 37 | #define RTT_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
37 | "set datafile separator ';' \n" \ | 38 | "set datafile separator ';' \n" \ |
38 | "set title \"Application level roundtrip time between Master and Slaves\" \n" \ | 39 | "set title \"Application level roundtrip time between Master and Slaves\" \n" \ |
39 | "set xlabel \"Time in ms\" \n" \ | 40 | "set xlabel \"Time in ms\" \n" \ |
40 | "set ylabel \"ms\" \n" | 41 | "set ylabel \"ms\" \n" \ |
42 | "set grid \n" | ||
41 | 43 | ||
42 | #define LOG_ITEMS_PER_PEER 7 | 44 | #define BW_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
43 | #define LOG_ITEMS_TIME 2 | 45 | "set datafile separator ';' \n" \ |
44 | 46 | "set title \"Bandwidth inbound and outbound between Master and Slaves\" \n" \ | |
45 | #define LOG_ITEMS_BYTES_SENT 1 | 47 | "set xlabel \"Time in ms\" \n" \ |
46 | #define LOG_ITEMS_MSGS_SENT 2 | 48 | "set ylabel \"Bytes / s \" \n" \ |
47 | #define LOG_ITEMS_THROUGHPUT_SENT 3 | 49 | "set grid \n" |
48 | #define LOG_ITEMS_BYTES_RECV 4 | ||
49 | #define LOG_ITEMS_MSGS_RECV 5 | ||
50 | #define LOG_ITEMS_THROUGHPUT_RECV 6 | ||
51 | #define LOG_ITEMS_APP_RTT 7 | ||
52 | 50 | ||
51 | #define LOG_ITEMS_TIME 2 | ||
52 | #define LOG_ITEMS_PER_PEER 17 | ||
53 | |||
54 | #define LOG_ITEM_BYTES_SENT 1 | ||
55 | #define LOG_ITEM_MSGS_SENT 2 | ||
56 | #define LOG_ITEM_THROUGHPUT_SENT 3 | ||
57 | #define LOG_ITEM_BYTES_RECV 4 | ||
58 | #define LOG_ITEM_MSGS_RECV 5 | ||
59 | #define LOG_ITEM_THROUGHPUT_RECV 6 | ||
60 | #define LOG_ITEM_APP_RTT 7 | ||
61 | #define LOG_ITEM_ATS_BW_IN 8 | ||
62 | #define LOG_ITEM_ATS_BW_OUT 9 | ||
63 | #define LOG_ITEM_ATS_COSTS_LAN 10 | ||
64 | #define LOG_ITEM_ATS_WAN 11 | ||
65 | #define LOG_ITEM_ATS_WLAN 12 | ||
66 | #define LOG_ITEM_ATS_DELAY 13 | ||
67 | #define LOG_ITEM_ATS_DISTANCE 14 | ||
68 | #define LOG_ITEM_ATS_NETWORKTYPE 15 | ||
69 | #define LOG_ITEM_ATS_UTIL_UP 16 | ||
70 | #define LOG_ITEM_ATS_UTIL_DOWN 17 | ||
53 | 71 | ||
54 | /** | 72 | /** |
55 | * Logging task | 73 | * Logging task |
@@ -255,8 +273,8 @@ write_throughput_gnuplot_script (char * fn, struct LoggingPeer *lp) | |||
255 | peer_index = LOG_ITEMS_TIME; | 273 | peer_index = LOG_ITEMS_TIME; |
256 | GNUNET_asprintf (&data, "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \ | 274 | GNUNET_asprintf (&data, "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \ |
257 | "'%s' using 2:%u with lines title 'Master %u receive total', \\\n", | 275 | "'%s' using 2:%u with lines title 'Master %u receive total', \\\n", |
258 | fn, peer_index + LOG_ITEMS_THROUGHPUT_SENT, lp->peer->no, | 276 | fn, peer_index + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no, |
259 | fn, peer_index + LOG_ITEMS_THROUGHPUT_RECV, lp->peer->no); | 277 | fn, peer_index + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no); |
260 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | 278 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) |
261 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | 279 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); |
262 | GNUNET_free (data); | 280 | GNUNET_free (data); |
@@ -266,8 +284,8 @@ write_throughput_gnuplot_script (char * fn, struct LoggingPeer *lp) | |||
266 | { | 284 | { |
267 | GNUNET_asprintf (&data, "'%s' using 2:%u with lines title 'Master %u - Slave %u send', \\\n" \ | 285 | GNUNET_asprintf (&data, "'%s' using 2:%u with lines title 'Master %u - Slave %u send', \\\n" \ |
268 | "'%s' using 2:%u with lines title 'Master %u - Slave %u receive'%s\n", | 286 | "'%s' using 2:%u with lines title 'Master %u - Slave %u receive'%s\n", |
269 | fn, peer_index + LOG_ITEMS_THROUGHPUT_SENT, lp->peer->no, lp->peer->partners[c_s].dest->no, | 287 | fn, peer_index + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no, lp->peer->partners[c_s].dest->no, |
270 | fn, peer_index + LOG_ITEMS_THROUGHPUT_RECV, lp->peer->no, lp->peer->partners[c_s].dest->no, | 288 | fn, peer_index + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no, lp->peer->partners[c_s].dest->no, |
271 | (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); | 289 | (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); |
272 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | 290 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) |
273 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | 291 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); |
@@ -314,7 +332,56 @@ write_rtt_gnuplot_script (char * fn, struct LoggingPeer *lp) | |||
314 | { | 332 | { |
315 | GNUNET_asprintf (&data, "%s'%s' using 2:%u with lines title 'Master %u - Slave %u '%s\n", | 333 | GNUNET_asprintf (&data, "%s'%s' using 2:%u with lines title 'Master %u - Slave %u '%s\n", |
316 | (0 == c_s) ? "plot " :"", | 334 | (0 == c_s) ? "plot " :"", |
317 | fn, index + LOG_ITEMS_APP_RTT, lp->peer->no, lp->peer->partners[c_s].dest->no, | 335 | fn, index + LOG_ITEM_APP_RTT, lp->peer->no, lp->peer->partners[c_s].dest->no, |
336 | (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); | ||
337 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | ||
338 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
339 | GNUNET_free (data); | ||
340 | index += LOG_ITEMS_PER_PEER; | ||
341 | } | ||
342 | |||
343 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) | ||
344 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn); | ||
345 | else | ||
346 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Data successfully written to plot file `%s'\n", gfn); | ||
347 | GNUNET_free (gfn); | ||
348 | } | ||
349 | |||
350 | static void | ||
351 | write_bw_gnuplot_script (char * fn, struct LoggingPeer *lp) | ||
352 | { | ||
353 | struct GNUNET_DISK_FileHandle *f; | ||
354 | char * gfn; | ||
355 | char *data; | ||
356 | int c_s; | ||
357 | int index; | ||
358 | |||
359 | GNUNET_asprintf (&gfn, "gnuplot_bw_%s",fn); | ||
360 | f = GNUNET_DISK_file_open (gfn, | ||
361 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, | ||
362 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
363 | if (NULL == f) | ||
364 | { | ||
365 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", gfn); | ||
366 | GNUNET_free (gfn); | ||
367 | return; | ||
368 | } | ||
369 | |||
370 | /* Write header */ | ||
371 | |||
372 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, BW_TEMPLATE, strlen(BW_TEMPLATE))) | ||
373 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
374 | |||
375 | index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER; | ||
376 | for (c_s = 0; c_s < lp->peer->num_partners; c_s++) | ||
377 | { | ||
378 | GNUNET_asprintf (&data, "%s"\ | ||
379 | "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \ | ||
380 | "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\ | ||
381 | "%s\n", | ||
382 | (0 == c_s) ? "plot " :"", | ||
383 | fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, lp->peer->partners[c_s].dest->no, | ||
384 | fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, lp->peer->partners[c_s].dest->no, | ||
318 | (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); | 385 | (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); |
319 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | 386 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) |
320 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | 387 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); |
@@ -329,6 +396,7 @@ write_rtt_gnuplot_script (char * fn, struct LoggingPeer *lp) | |||
329 | GNUNET_free (gfn); | 396 | GNUNET_free (gfn); |
330 | } | 397 | } |
331 | 398 | ||
399 | |||
332 | static void | 400 | static void |
333 | write_to_file () | 401 | write_to_file () |
334 | { | 402 | { |
@@ -374,21 +442,28 @@ write_to_file () | |||
374 | 442 | ||
375 | /* Assembling slave string */ | 443 | /* Assembling slave string */ |
376 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 444 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
377 | "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u \n", plt->slave->no, | 445 | "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u bw_in %u bw_out %u \n", plt->slave->no, |
378 | plt->total_messages_sent, plt->total_bytes_sent, plt->throughput_sent, | 446 | plt->total_messages_sent, plt->total_bytes_sent, plt->throughput_sent, |
379 | plt->total_messages_received, plt->total_bytes_received, plt->throughput_recv, | 447 | plt->total_messages_received, plt->total_bytes_received, plt->throughput_recv, |
380 | plt->app_rtt, plt->ats_delay); | 448 | plt->app_rtt, plt->ats_delay, |
381 | 449 | plt->bandwidth_in, plt->bandwidth_out); | |
382 | 450 | ||
383 | GNUNET_asprintf(&slave_string_tmp, "%s%u;%u;%u;%u;%u;%u;%.3f;",slave_string, | 451 | GNUNET_asprintf(&slave_string_tmp, "%s%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%u;%u;%u;",slave_string, |
384 | plt->total_messages_sent, plt->total_bytes_sent, plt->throughput_sent, | 452 | plt->total_messages_sent, plt->total_bytes_sent, plt->throughput_sent, |
385 | plt->total_messages_received, plt->total_bytes_received, plt->throughput_sent, | 453 | plt->total_messages_received, plt->total_bytes_received, plt->throughput_sent, |
386 | (double) plt->app_rtt / 1000); | 454 | (double) plt->app_rtt / 1000, |
455 | plt->bandwidth_in,plt->bandwidth_out, | ||
456 | plt->ats_cost_lan, plt->ats_cost_wan, plt->ats_cost_wlan, | ||
457 | plt->ats_delay, plt->ats_distance, plt->ats_network_type, | ||
458 | plt->ats_utilization_up, plt->ats_utilization_down); | ||
387 | GNUNET_free (slave_string); | 459 | GNUNET_free (slave_string); |
388 | slave_string = slave_string_tmp; | 460 | slave_string = slave_string_tmp; |
389 | } | 461 | } |
390 | /* Assembling master string */ | 462 | /* Assembling master string */ |
391 | GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;%s\n", | 463 | |
464 | |||
465 | |||
466 | GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;;;;;;;;;;;%s\n", | ||
392 | cur_lt->timestamp, | 467 | cur_lt->timestamp, |
393 | GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, | 468 | GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, |
394 | cur_lt->total_messages_sent, cur_lt->total_bytes_sent, cur_lt->total_throughput_send, | 469 | cur_lt->total_messages_sent, cur_lt->total_bytes_sent, cur_lt->total_throughput_send, |
@@ -409,6 +484,7 @@ write_to_file () | |||
409 | 484 | ||
410 | write_throughput_gnuplot_script (filename, lp); | 485 | write_throughput_gnuplot_script (filename, lp); |
411 | write_rtt_gnuplot_script (filename, lp); | 486 | write_rtt_gnuplot_script (filename, lp); |
487 | write_bw_gnuplot_script (filename, lp); | ||
412 | 488 | ||
413 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Data file successfully written to log file `%s'\n", filename); | 489 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Data file successfully written to log file `%s'\n", filename); |
414 | GNUNET_free (filename); | 490 | GNUNET_free (filename); |
@@ -511,6 +587,8 @@ collect_log_now (void) | |||
511 | slt->ats_network_type = p->ats_network_type; | 587 | slt->ats_network_type = p->ats_network_type; |
512 | slt->ats_utilization_down = p->ats_utilization_down; | 588 | slt->ats_utilization_down = p->ats_utilization_down; |
513 | slt->ats_utilization_up = p->ats_utilization_up; | 589 | slt->ats_utilization_up = p->ats_utilization_up; |
590 | slt->bandwidth_in = p->bandwidth_in; | ||
591 | slt->bandwidth_out = p->bandwidth_out; | ||
514 | 592 | ||
515 | /* Total application level rtt */ | 593 | /* Total application level rtt */ |
516 | if (NULL == prev_log_mlt) | 594 | if (NULL == prev_log_mlt) |