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 | |
parent | f7ab01ca8f81b40e8a8ea2992bdaf6cad772554f (diff) |
bandwidth gnuplot
Diffstat (limited to 'src/ats-tests')
-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 56d00b9979..6dc5a96b40 100644 --- a/src/ats-tests/perf_ats_logging.c +++ b/src/ats-tests/perf_ats_logging.c @@ -31,25 +31,43 @@ "set datafile separator ';' \n" \ "set title \"Throughput between Master and Slaves\" \n" \ "set xlabel \"Time in ms\" \n" \ -"set ylabel \"Bytes/s\" \n" +"set ylabel \"Bytes/s\" \n" \ +"set grid \n" #define RTT_TEMPLATE "#!/usr/bin/gnuplot \n" \ "set datafile separator ';' \n" \ "set title \"Application level roundtrip time between Master and Slaves\" \n" \ "set xlabel \"Time in ms\" \n" \ -"set ylabel \"ms\" \n" +"set ylabel \"ms\" \n" \ +"set grid \n" -#define LOG_ITEMS_PER_PEER 7 -#define LOG_ITEMS_TIME 2 - -#define LOG_ITEMS_BYTES_SENT 1 -#define LOG_ITEMS_MSGS_SENT 2 -#define LOG_ITEMS_THROUGHPUT_SENT 3 -#define LOG_ITEMS_BYTES_RECV 4 -#define LOG_ITEMS_MSGS_RECV 5 -#define LOG_ITEMS_THROUGHPUT_RECV 6 -#define LOG_ITEMS_APP_RTT 7 +#define BW_TEMPLATE "#!/usr/bin/gnuplot \n" \ +"set datafile separator ';' \n" \ +"set title \"Bandwidth inbound and outbound between Master and Slaves\" \n" \ +"set xlabel \"Time in ms\" \n" \ +"set ylabel \"Bytes / s \" \n" \ +"set grid \n" +#define LOG_ITEMS_TIME 2 +#define LOG_ITEMS_PER_PEER 17 + +#define LOG_ITEM_BYTES_SENT 1 +#define LOG_ITEM_MSGS_SENT 2 +#define LOG_ITEM_THROUGHPUT_SENT 3 +#define LOG_ITEM_BYTES_RECV 4 +#define LOG_ITEM_MSGS_RECV 5 +#define LOG_ITEM_THROUGHPUT_RECV 6 +#define LOG_ITEM_APP_RTT 7 +#define LOG_ITEM_ATS_BW_IN 8 +#define LOG_ITEM_ATS_BW_OUT 9 +#define LOG_ITEM_ATS_COSTS_LAN 10 +#define LOG_ITEM_ATS_WAN 11 +#define LOG_ITEM_ATS_WLAN 12 +#define LOG_ITEM_ATS_DELAY 13 +#define LOG_ITEM_ATS_DISTANCE 14 +#define LOG_ITEM_ATS_NETWORKTYPE 15 +#define LOG_ITEM_ATS_UTIL_UP 16 +#define LOG_ITEM_ATS_UTIL_DOWN 17 /** * Logging task @@ -255,8 +273,8 @@ write_throughput_gnuplot_script (char * fn, struct LoggingPeer *lp) peer_index = LOG_ITEMS_TIME; GNUNET_asprintf (&data, "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \ "'%s' using 2:%u with lines title 'Master %u receive total', \\\n", - fn, peer_index + LOG_ITEMS_THROUGHPUT_SENT, lp->peer->no, - fn, peer_index + LOG_ITEMS_THROUGHPUT_RECV, lp->peer->no); + fn, peer_index + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no, + fn, peer_index + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no); if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); GNUNET_free (data); @@ -266,8 +284,8 @@ write_throughput_gnuplot_script (char * fn, struct LoggingPeer *lp) { GNUNET_asprintf (&data, "'%s' using 2:%u with lines title 'Master %u - Slave %u send', \\\n" \ "'%s' using 2:%u with lines title 'Master %u - Slave %u receive'%s\n", - fn, peer_index + LOG_ITEMS_THROUGHPUT_SENT, lp->peer->no, lp->peer->partners[c_s].dest->no, - fn, peer_index + LOG_ITEMS_THROUGHPUT_RECV, lp->peer->no, lp->peer->partners[c_s].dest->no, + fn, peer_index + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no, lp->peer->partners[c_s].dest->no, + fn, peer_index + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no, lp->peer->partners[c_s].dest->no, (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) 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) { GNUNET_asprintf (&data, "%s'%s' using 2:%u with lines title 'Master %u - Slave %u '%s\n", (0 == c_s) ? "plot " :"", - fn, index + LOG_ITEMS_APP_RTT, lp->peer->no, lp->peer->partners[c_s].dest->no, + fn, index + LOG_ITEM_APP_RTT, lp->peer->no, lp->peer->partners[c_s].dest->no, + (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); + if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); + GNUNET_free (data); + index += LOG_ITEMS_PER_PEER; + } + + if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn); + else + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Data successfully written to plot file `%s'\n", gfn); + GNUNET_free (gfn); +} + +static void +write_bw_gnuplot_script (char * fn, struct LoggingPeer *lp) +{ + struct GNUNET_DISK_FileHandle *f; + char * gfn; + char *data; + int c_s; + int index; + + GNUNET_asprintf (&gfn, "gnuplot_bw_%s",fn); + f = GNUNET_DISK_file_open (gfn, + GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, + GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); + if (NULL == f) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", gfn); + GNUNET_free (gfn); + return; + } + + /* Write header */ + + if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, BW_TEMPLATE, strlen(BW_TEMPLATE))) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); + + index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER; + for (c_s = 0; c_s < lp->peer->num_partners; c_s++) + { + GNUNET_asprintf (&data, "%s"\ + "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \ + "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\ + "%s\n", + (0 == c_s) ? "plot " :"", + fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, lp->peer->partners[c_s].dest->no, + fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, lp->peer->partners[c_s].dest->no, (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) 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) GNUNET_free (gfn); } + static void write_to_file () { @@ -374,21 +442,28 @@ write_to_file () /* Assembling slave string */ GNUNET_log(GNUNET_ERROR_TYPE_INFO, - "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u \n", plt->slave->no, + "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u bw_in %u bw_out %u \n", plt->slave->no, plt->total_messages_sent, plt->total_bytes_sent, plt->throughput_sent, plt->total_messages_received, plt->total_bytes_received, plt->throughput_recv, - plt->app_rtt, plt->ats_delay); - + plt->app_rtt, plt->ats_delay, + plt->bandwidth_in, plt->bandwidth_out); - GNUNET_asprintf(&slave_string_tmp, "%s%u;%u;%u;%u;%u;%u;%.3f;",slave_string, + 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, plt->total_messages_sent, plt->total_bytes_sent, plt->throughput_sent, plt->total_messages_received, plt->total_bytes_received, plt->throughput_sent, - (double) plt->app_rtt / 1000); + (double) plt->app_rtt / 1000, + plt->bandwidth_in,plt->bandwidth_out, + plt->ats_cost_lan, plt->ats_cost_wan, plt->ats_cost_wlan, + plt->ats_delay, plt->ats_distance, plt->ats_network_type, + plt->ats_utilization_up, plt->ats_utilization_down); GNUNET_free (slave_string); slave_string = slave_string_tmp; } /* Assembling master string */ - GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;%s\n", + + + + GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;;;;;;;;;;;%s\n", cur_lt->timestamp, GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, cur_lt->total_messages_sent, cur_lt->total_bytes_sent, cur_lt->total_throughput_send, @@ -409,6 +484,7 @@ write_to_file () write_throughput_gnuplot_script (filename, lp); write_rtt_gnuplot_script (filename, lp); + write_bw_gnuplot_script (filename, lp); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Data file successfully written to log file `%s'\n", filename); GNUNET_free (filename); @@ -511,6 +587,8 @@ collect_log_now (void) slt->ats_network_type = p->ats_network_type; slt->ats_utilization_down = p->ats_utilization_down; slt->ats_utilization_up = p->ats_utilization_up; + slt->bandwidth_in = p->bandwidth_in; + slt->bandwidth_out = p->bandwidth_out; /* Total application level rtt */ if (NULL == prev_log_mlt) |