diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-21 05:46:43 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-21 05:46:43 +0000 |
commit | 7dfd81bc34f8be875dbaefec928d61a67be2daf6 (patch) | |
tree | db307973024675534434808c450d73e5862e7bcc /src/ats/test_ats_api_scheduling_destroy_session.c | |
parent | 084f7e3620774cf976ef955a3db5df9ff7651263 (diff) | |
download | gnunet-7dfd81bc34f8be875dbaefec928d61a67be2daf6.tar.gz gnunet-7dfd81bc34f8be875dbaefec928d61a67be2daf6.zip |
adding initial statistics call
Diffstat (limited to 'src/ats/test_ats_api_scheduling_destroy_session.c')
-rw-r--r-- | src/ats/test_ats_api_scheduling_destroy_session.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/ats/test_ats_api_scheduling_destroy_session.c b/src/ats/test_ats_api_scheduling_destroy_session.c index dc53a894d..69d9b88a7 100644 --- a/src/ats/test_ats_api_scheduling_destroy_session.c +++ b/src/ats/test_ats_api_scheduling_destroy_session.c | |||
@@ -165,16 +165,12 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
165 | return; | 165 | return; |
166 | } | 166 | } |
167 | 167 | ||
168 | |||
169 | static void | 168 | static void |
170 | run (void *cls, | 169 | got_initial_value (void *cls, int success) |
171 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
172 | struct GNUNET_TESTING_Peer *peer) | ||
173 | { | 170 | { |
174 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | 171 | struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
175 | stats = GNUNET_STATISTICS_create ("ats", cfg); | ||
176 | GNUNET_STATISTICS_watch (stats, "ats", "# addresses", &stat_cb, NULL); | ||
177 | 172 | ||
173 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got initial value\n"); | ||
178 | 174 | ||
179 | /* Connect to ATS scheduling */ | 175 | /* Connect to ATS scheduling */ |
180 | sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); | 176 | sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); |
@@ -203,6 +199,33 @@ run (void *cls, | |||
203 | 199 | ||
204 | /* Adding address */ | 200 | /* Adding address */ |
205 | GNUNET_ATS_address_add (sched_ats, &test_hello_address, NULL, test_ats_info, test_ats_count); | 201 | GNUNET_ATS_address_add (sched_ats, &test_hello_address, NULL, test_ats_info, test_ats_count); |
202 | |||
203 | } | ||
204 | |||
205 | static int | ||
206 | dummy_stat (void *cls, const char *subsystem, const char *name, uint64_t value, | ||
207 | int is_persistent) | ||
208 | { | ||
209 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got dummy stat %s%s:%s = %llu\n", | ||
210 | is_persistent ? "!" : " ", subsystem, name, value); | ||
211 | return GNUNET_OK; | ||
212 | } | ||
213 | |||
214 | |||
215 | |||
216 | static void | ||
217 | run (void *cls, | ||
218 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
219 | struct GNUNET_TESTING_Peer *peer) | ||
220 | { | ||
221 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | ||
222 | stats = GNUNET_STATISTICS_create ("ats", cfg); | ||
223 | GNUNET_STATISTICS_watch (stats, "ats", "# addresses", &stat_cb, NULL); | ||
224 | |||
225 | |||
226 | GNUNET_STATISTICS_get (stats, "ats", "# addresses", TIMEOUT, | ||
227 | &got_initial_value, &dummy_stat, | ||
228 | GNUNET_CONFIGURATION_dup (cfg)); | ||
206 | } | 229 | } |
207 | 230 | ||
208 | 231 | ||