diff options
Diffstat (limited to 'src/fs/perf_gnunet_service_fs_p2p.c')
-rw-r--r-- | src/fs/perf_gnunet_service_fs_p2p.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c index 5f9c80705..e2f58d13d 100644 --- a/src/fs/perf_gnunet_service_fs_p2p.c +++ b/src/fs/perf_gnunet_service_fs_p2p.c | |||
@@ -51,6 +51,8 @@ static struct GNUNET_TIME_Absolute start_time; | |||
51 | 51 | ||
52 | static const char *progname; | 52 | static const char *progname; |
53 | 53 | ||
54 | static struct GNUNET_TIME_Absolute start_time; | ||
55 | |||
54 | 56 | ||
55 | /** | 57 | /** |
56 | * Master context for 'stat_run'. | 58 | * Master context for 'stat_run'. |
@@ -105,8 +107,8 @@ static struct StatValues stats[] = { | |||
105 | * @param subsystem name of subsystem that created the statistic | 107 | * @param subsystem name of subsystem that created the statistic |
106 | * @param name the name of the datum | 108 | * @param name the name of the datum |
107 | * @param value the current value | 109 | * @param value the current value |
108 | * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not | 110 | * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not |
109 | * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration | 111 | * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration |
110 | */ | 112 | */ |
111 | static int | 113 | static int |
112 | print_stat (void *cls, const char *subsystem, const char *name, uint64_t value, | 114 | print_stat (void *cls, const char *subsystem, const char *name, uint64_t value, |
@@ -114,8 +116,12 @@ print_stat (void *cls, const char *subsystem, const char *name, uint64_t value, | |||
114 | { | 116 | { |
115 | struct StatMaster *sm = cls; | 117 | struct StatMaster *sm = cls; |
116 | 118 | ||
117 | FPRINTF (stderr, "Peer %2u: %12s/%50s = %12llu\n", sm->daemon, subsystem, | 119 | FPRINTF (stderr, |
118 | name, (unsigned long long) value); | 120 | "Peer %2u: %12s/%50s = %12llu\n", |
121 | sm->daemon, | ||
122 | subsystem, | ||
123 | name, | ||
124 | (unsigned long long) value); | ||
119 | return GNUNET_OK; | 125 | return GNUNET_OK; |
120 | } | 126 | } |
121 | 127 | ||
@@ -232,7 +238,8 @@ stat_run (void *cls, | |||
232 | 238 | ||
233 | 239 | ||
234 | static void | 240 | static void |
235 | do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 241 | do_report (void *cls, |
242 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
236 | { | 243 | { |
237 | char *fn = cls; | 244 | char *fn = cls; |
238 | struct GNUNET_TIME_Relative del; | 245 | struct GNUNET_TIME_Relative del; |
@@ -244,7 +251,9 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
244 | GNUNET_DISK_directory_remove (fn); | 251 | GNUNET_DISK_directory_remove (fn); |
245 | GNUNET_free (fn); | 252 | GNUNET_free (fn); |
246 | } | 253 | } |
247 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) | 254 | if (0 == |
255 | GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_add (start_time, | ||
256 | TIMEOUT)).rel_value_us) | ||
248 | { | 257 | { |
249 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 258 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
250 | "Timeout during download, shutting down with error\n"); | 259 | "Timeout during download, shutting down with error\n"); |
@@ -297,7 +306,13 @@ do_download (void *cls, | |||
297 | anonymity = 0; | 306 | anonymity = 0; |
298 | else | 307 | else |
299 | anonymity = 1; | 308 | anonymity = 1; |
300 | GNUNET_FS_TEST_download (daemons[0], TIMEOUT, anonymity, SEED, uri, VERBOSE, | 309 | start_time = GNUNET_TIME_absolute_get (); |
310 | GNUNET_FS_TEST_download (daemons[0], | ||
311 | TIMEOUT, | ||
312 | anonymity, | ||
313 | SEED, | ||
314 | uri, | ||
315 | VERBOSE, | ||
301 | &do_report, | 316 | &do_report, |
302 | (NULL == fn) ? NULL : GNUNET_strdup (fn)); | 317 | (NULL == fn) ? NULL : GNUNET_strdup (fn)); |
303 | } | 318 | } |