diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-19 08:13:33 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-19 08:13:33 +0000 |
commit | 44da7c75264ac48c113ffecb6593169793f89956 (patch) | |
tree | aa253e726c9bdb628243091a0ad8a9802ddd4c83 /src/ats-tests/perf_ats_logging.c | |
parent | cfdc5b2d2c092cdb5efa5a64e9cc1df6ef26de58 (diff) | |
download | gnunet-44da7c75264ac48c113ffecb6593169793f89956.tar.gz gnunet-44da7c75264ac48c113ffecb6593169793f89956.zip |
slave data extraction
Diffstat (limited to 'src/ats-tests/perf_ats_logging.c')
-rw-r--r-- | src/ats-tests/perf_ats_logging.c | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c index 2979dd647..e52ac4b0d 100644 --- a/src/ats-tests/perf_ats_logging.c +++ b/src/ats-tests/perf_ats_logging.c | |||
@@ -157,11 +157,14 @@ write_to_file () | |||
157 | struct GNUNET_DISK_FileHandle *f; | 157 | struct GNUNET_DISK_FileHandle *f; |
158 | char * filename; | 158 | char * filename; |
159 | char *data; | 159 | char *data; |
160 | struct PeerLoggingTimestep *cur; | 160 | struct PeerLoggingTimestep *cur_lt; |
161 | struct PartnerLoggingTimestep *plt; | ||
161 | int c_m; | 162 | int c_m; |
162 | //int c_s; | 163 | int c_s; |
163 | unsigned int throughput_recv; | 164 | unsigned int throughput_recv; |
164 | unsigned int throughput_send; | 165 | unsigned int throughput_send; |
166 | unsigned int throughput_recv_slave; | ||
167 | unsigned int throughput_send_slave; | ||
165 | double mult; | 168 | double mult; |
166 | 169 | ||
167 | GNUNET_asprintf (&filename, "%llu_%s.data", GNUNET_TIME_absolute_get().abs_value_us,name); | 170 | GNUNET_asprintf (&filename, "%llu_%s.data", GNUNET_TIME_absolute_get().abs_value_us,name); |
@@ -178,36 +181,57 @@ write_to_file () | |||
178 | 181 | ||
179 | for (c_m = 0; c_m < num_peers; c_m++) | 182 | for (c_m = 0; c_m < num_peers; c_m++) |
180 | { | 183 | { |
181 | for (cur = lp[c_m].head; NULL != cur; cur = cur->next) | 184 | for (cur_lt = lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next) |
182 | { | 185 | { |
183 | mult = (1.0 * 1000 * 1000) / (LOGGING_FREQUENCY.rel_value_us); | 186 | mult = (1.0 * 1000 * 1000) / (LOGGING_FREQUENCY.rel_value_us); |
184 | if (NULL != cur->prev) | 187 | if (NULL != cur_lt->prev) |
185 | { | 188 | { |
186 | throughput_send = cur->total_bytes_sent - cur->prev->total_bytes_sent; | 189 | throughput_send = cur_lt->total_bytes_sent - cur_lt->prev->total_bytes_sent; |
187 | throughput_recv = cur->total_bytes_received - cur->prev->total_bytes_received; | 190 | throughput_recv = cur_lt->total_bytes_received - cur_lt->prev->total_bytes_received; |
188 | } | 191 | } |
189 | else | 192 | else |
190 | { | 193 | { |
191 | throughput_send = cur->total_bytes_sent; | 194 | throughput_send = cur_lt->total_bytes_sent; |
192 | throughput_recv = cur->total_bytes_received; | 195 | throughput_recv = cur_lt->total_bytes_received; |
193 | } | 196 | } |
194 | throughput_send *= mult; | 197 | throughput_send *= mult; |
195 | throughput_recv *= mult; | 198 | throughput_recv *= mult; |
196 | 199 | ||
197 | 200 | ||
198 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 201 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
199 | "Master [%u]: timestamp %llu %llu %u %u %u ; %u %u %u\n", lp[c_m].peer->no, | 202 | "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n", lp[c_m].peer->no, |
200 | cur->timestamp, GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur->timestamp).rel_value_us / 1000, | 203 | cur_lt->timestamp, GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, |
201 | cur->total_messages_sent, cur->total_bytes_sent, throughput_send, | 204 | cur_lt->total_messages_sent, cur_lt->total_bytes_sent, throughput_send, |
202 | cur->total_messages_received, cur->total_bytes_received, throughput_recv); | 205 | cur_lt->total_messages_received, cur_lt->total_bytes_received, throughput_recv); |
203 | 206 | ||
204 | // for () | 207 | for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++) |
208 | { | ||
209 | /* Log partners */ | ||
210 | plt = &cur_lt->slaves_log[c_s]; | ||
211 | if (NULL != cur_lt->prev) | ||
212 | { | ||
213 | throughput_send_slave = plt->total_bytes_sent - cur_lt->prev->slaves_log[c_s].total_bytes_sent; | ||
214 | throughput_recv_slave = plt->total_bytes_received - cur_lt->prev->slaves_log[c_s].total_bytes_received; | ||
215 | } | ||
216 | else | ||
217 | { | ||
218 | throughput_send_slave = plt->total_bytes_sent; | ||
219 | throughput_recv_slave = plt->total_bytes_received; | ||
220 | } | ||
221 | throughput_send_slave *= mult; | ||
222 | throughput_recv_slave *= mult; | ||
223 | |||
224 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
225 | "\t Slave [%u]: %u %u %u ; %u %u %u \n", plt->slave->no, | ||
226 | plt->total_messages_sent, plt->total_bytes_sent, throughput_send_slave, | ||
227 | plt->total_messages_received, plt->total_bytes_received, throughput_recv_slave); | ||
228 | } | ||
205 | 229 | ||
206 | GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u\n", | 230 | GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u\n", |
207 | cur->timestamp, | 231 | cur_lt->timestamp, |
208 | GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur->timestamp).rel_value_us / 1000, | 232 | GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur_lt->timestamp).rel_value_us / 1000, |
209 | cur->total_messages_sent, cur->total_bytes_sent, throughput_send, | 233 | cur_lt->total_messages_sent, cur_lt->total_bytes_sent, throughput_send, |
210 | cur->total_messages_received, cur->total_bytes_received, throughput_recv); | 234 | cur_lt->total_messages_received, cur_lt->total_bytes_received, throughput_recv); |
211 | 235 | ||
212 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | 236 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) |
213 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to log file `%s'\n", filename); | 237 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to log file `%s'\n", filename); |