diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-19 11:36:47 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-19 11:36:47 +0000 |
commit | 656c7503c6074425e86ad0e9d4e407de21d3e73d (patch) | |
tree | cf262da5557c34a81ba0b3c20e3b89ab28652f2c /src | |
parent | 38f8219826605a05286f1786a04183186d6578d0 (diff) | |
download | gnunet-656c7503c6074425e86ad0e9d4e407de21d3e73d.tar.gz gnunet-656c7503c6074425e86ad0e9d4e407de21d3e73d.zip |
gnunplot script generation
Diffstat (limited to 'src')
-rw-r--r-- | src/ats-tests/perf_ats_logging.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c index 6dbf114eb..055ad7272 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 LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500) | 30 | #define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500) |
31 | 31 | ||
32 | #define template "#!/usr/bin/gnuplot \n" \ | 32 | #define THROUGHPUT_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
33 | "set datafile separator ';' \n" \ | 33 | "set datafile separator ';' \n" \ |
34 | "set title \"Throughput\" \n" \ | 34 | "set title \"Throughput\" \n" \ |
35 | "set xlabel \"Time in ms\" \n" \ | 35 | "set xlabel \"Time in ms\" \n" \ |
@@ -160,10 +160,13 @@ static struct LoggingPeer *lp; | |||
160 | static void | 160 | static void |
161 | write_gnuplot_script (char * fn, struct LoggingPeer *lp) | 161 | write_gnuplot_script (char * fn, struct LoggingPeer *lp) |
162 | { | 162 | { |
163 | char * gfn; | ||
164 | struct GNUNET_DISK_FileHandle *f; | 163 | struct GNUNET_DISK_FileHandle *f; |
165 | GNUNET_asprintf (&gfn, "gnuplot_%s",fn); | 164 | char * gfn; |
165 | char *data; | ||
166 | int c_s; | ||
167 | int index; | ||
166 | 168 | ||
169 | GNUNET_asprintf (&gfn, "gnuplot_%s",fn); | ||
167 | f = GNUNET_DISK_file_open (gfn, | 170 | f = GNUNET_DISK_file_open (gfn, |
168 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, | 171 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, |
169 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 172 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
@@ -176,12 +179,31 @@ write_gnuplot_script (char * fn, struct LoggingPeer *lp) | |||
176 | 179 | ||
177 | /* Write header */ | 180 | /* Write header */ |
178 | 181 | ||
179 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, template, strlen(template))) | 182 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, THROUGHPUT_TEMPLATE, strlen(THROUGHPUT_TEMPLATE))) |
180 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | 183 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); |
181 | 184 | ||
182 | /* Write data */ | 185 | /* Write master data */ |
183 | 186 | GNUNET_asprintf (&data, "plot '%s' using 2:%u with lines title 'Master %u send', \\\n" \ | |
187 | "'%s' using 2:%u with lines title 'Master %u receive', \\\n", | ||
188 | fn, 5, lp->peer->no, | ||
189 | fn, 8, lp->peer->no); | ||
190 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | ||
191 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
192 | GNUNET_free (data); | ||
184 | 193 | ||
194 | index = 11; | ||
195 | for (c_s = 0; c_s < lp->peer->num_partners; c_s++) | ||
196 | { | ||
197 | GNUNET_asprintf (&data, "'%s' using 2:%u with lines title 'Slave %u send', \\\n" \ | ||
198 | "'%s' using 2:%u with lines title 'Slave %u receive'%s\n", | ||
199 | fn, index, lp->peer->no, | ||
200 | fn, index+3, lp->peer->no, | ||
201 | (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); | ||
202 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | ||
203 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
204 | GNUNET_free (data); | ||
205 | index += 6; | ||
206 | } | ||
185 | 207 | ||
186 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) | 208 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) |
187 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn); | 209 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn); |
@@ -209,7 +231,7 @@ write_to_file () | |||
209 | 231 | ||
210 | for (c_m = 0; c_m < num_peers; c_m++) | 232 | for (c_m = 0; c_m < num_peers; c_m++) |
211 | { | 233 | { |
212 | GNUNET_asprintf (&filename, "%llu_master_[%u]_%s_%s.data", GNUNET_TIME_absolute_get().abs_value_us, | 234 | GNUNET_asprintf (&filename, "%llu_master_%u_%s_%s.data", GNUNET_TIME_absolute_get().abs_value_us, |
213 | lp[c_m].peer->no, GNUNET_i2s(&lp[c_m].peer->id), name); | 235 | lp[c_m].peer->no, GNUNET_i2s(&lp[c_m].peer->id), name); |
214 | 236 | ||
215 | f = GNUNET_DISK_file_open (filename, | 237 | f = GNUNET_DISK_file_open (filename, |