aboutsummaryrefslogtreecommitdiff
path: root/src/fs/perf_gnunet_service_fs_p2p.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-08-03 09:35:48 +0000
committerChristian Grothoff <christian@grothoff.org>2015-08-03 09:35:48 +0000
commitd3e7a5e40dd2d5409009a30e1e41148c4d852673 (patch)
tree21ff19580a99137e9b8aec4393feb67f0f1c7b5a /src/fs/perf_gnunet_service_fs_p2p.c
parentec69ceabc67a72373a2579d871c5fe85676a73bd (diff)
downloadgnunet-d3e7a5e40dd2d5409009a30e1e41148c4d852673.tar.gz
gnunet-d3e7a5e40dd2d5409009a30e1e41148c4d852673.zip
-use simpler, modern scheduler API
Diffstat (limited to 'src/fs/perf_gnunet_service_fs_p2p.c')
-rw-r--r--src/fs/perf_gnunet_service_fs_p2p.c29
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
52static const char *progname; 52static const char *progname;
53 53
54static 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 */
111static int 113static int
112print_stat (void *cls, const char *subsystem, const char *name, uint64_t value, 114print_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
234static void 240static void
235do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 241do_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}