aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-ats-solver-eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ats/gnunet-ats-solver-eval.c')
-rw-r--r--src/ats/gnunet-ats-solver-eval.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c
index 9866ca929..6a014357e 100644
--- a/src/ats/gnunet-ats-solver-eval.c
+++ b/src/ats/gnunet-ats-solver-eval.c
@@ -123,6 +123,7 @@ find_peer_by_id (int id)
123 return NULL; 123 return NULL;
124} 124}
125 125
126
126static struct TestPeer * 127static struct TestPeer *
127find_peer_by_pid (const struct GNUNET_PeerIdentity *pid) 128find_peer_by_pid (const struct GNUNET_PeerIdentity *pid)
128{ 129{
@@ -134,6 +135,7 @@ find_peer_by_pid (const struct GNUNET_PeerIdentity *pid)
134 return NULL; 135 return NULL;
135} 136}
136 137
138
137static struct TestAddress * 139static struct TestAddress *
138find_address_by_id (struct TestPeer *peer, int aid) 140find_address_by_id (struct TestPeer *peer, int aid)
139{ 141{
@@ -238,6 +240,7 @@ logging_task (void *cls)
238 l); 240 l);
239} 241}
240 242
243
241struct LoggingHandle * 244struct LoggingHandle *
242GNUNET_ATS_solver_logging_start (struct GNUNET_TIME_Relative freq) 245GNUNET_ATS_solver_logging_start (struct GNUNET_TIME_Relative freq)
243{ 246{
@@ -252,6 +255,7 @@ GNUNET_ATS_solver_logging_start (struct GNUNET_TIME_Relative freq)
252 return l; 255 return l;
253} 256}
254 257
258
255void 259void
256GNUNET_ATS_solver_logging_stop (struct LoggingHandle *l) 260GNUNET_ATS_solver_logging_stop (struct LoggingHandle *l)
257{ 261{
@@ -263,6 +267,7 @@ GNUNET_ATS_solver_logging_stop (struct LoggingHandle *l)
263 l->logging_task = NULL; 267 l->logging_task = NULL;
264} 268}
265 269
270
266static struct LoggingFileHandle * 271static struct LoggingFileHandle *
267find_logging_file_handle (struct LoggingFileHandle *lf_head, 272find_logging_file_handle (struct LoggingFileHandle *lf_head,
268 struct LoggingFileHandle *lf_tail, 273 struct LoggingFileHandle *lf_tail,
@@ -276,6 +281,7 @@ find_logging_file_handle (struct LoggingFileHandle *lf_head,
276 return NULL; 281 return NULL;
277} 282}
278 283
284
279void 285void
280GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l, int 286GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l, int
281 add_time_stamp, 287 add_time_stamp,
@@ -391,8 +397,7 @@ GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l, int
391 fprintf(stderr,"\t %s = %.2f %.2f [abs/rel]\n", 397 fprintf(stderr,"\t %s = %.2f %.2f [abs/rel]\n",
392 GNUNET_ATS_print_preference_type(c), 398 GNUNET_ATS_print_preference_type(c),
393 log_p->pref_abs[c], log_p->pref_norm[c]); 399 log_p->pref_abs[c], log_p->pref_norm[c]);
394 */ 400 */GNUNET_asprintf (&prefstring_tmp, "%s;%.3f;%.3f",
395 GNUNET_asprintf (&prefstring_tmp, "%s;%.3f;%.3f",
396 prefstring, log_p->pref_abs[c], log_p->pref_norm[c]); 401 prefstring, log_p->pref_abs[c], log_p->pref_norm[c]);
397 402
398 403
@@ -449,6 +454,7 @@ cleanup:
449 } 454 }
450} 455}
451 456
457
452void 458void
453GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l) 459GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l)
454{ 460{
@@ -493,6 +499,7 @@ GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l)
493 } 499 }
494} 500}
495 501
502
496void 503void
497GNUNET_ATS_solver_logging_free (struct LoggingHandle *l) 504GNUNET_ATS_solver_logging_free (struct LoggingHandle *l)
498{ 505{
@@ -538,6 +545,7 @@ GNUNET_ATS_solver_logging_free (struct LoggingHandle *l)
538 GNUNET_free (l); 545 GNUNET_free (l);
539} 546}
540 547
548
541/** 549/**
542 * Property Generators 550 * Property Generators
543 */ 551 */
@@ -701,6 +709,7 @@ find_prop_gen (unsigned int peer, unsigned int address,
701 return NULL; 709 return NULL;
702} 710}
703 711
712
704void 713void
705GNUNET_ATS_solver_generate_property_stop (struct PropertyGenerator *pg) 714GNUNET_ATS_solver_generate_property_stop (struct PropertyGenerator *pg)
706{ 715{
@@ -1056,6 +1065,7 @@ find_pref_gen (unsigned int peer, enum GNUNET_ATS_PreferenceKind kind)
1056 return NULL; 1065 return NULL;
1057} 1066}
1058 1067
1068
1059void 1069void
1060GNUNET_ATS_solver_generate_preferences_stop (struct PreferenceGenerator *pg) 1070GNUNET_ATS_solver_generate_preferences_stop (struct PreferenceGenerator *pg)
1061{ 1071{
@@ -1210,7 +1220,6 @@ GNUNET_ATS_solver_generate_preferences_start (unsigned int peer,
1210} 1220}
1211 1221
1212 1222
1213
1214/** 1223/**
1215 * Stop all preferences generators 1224 * Stop all preferences generators
1216 */ 1225 */
@@ -1229,7 +1238,6 @@ GNUNET_ATS_solver_generate_preferences_stop_all ()
1229} 1238}
1230 1239
1231 1240
1232
1233/** 1241/**
1234 * Experiments 1242 * Experiments
1235 */ 1243 */
@@ -1983,6 +1991,7 @@ load_op_start_set_property (struct GNUNET_ATS_TEST_Operation *o,
1983 return GNUNET_OK; 1991 return GNUNET_OK;
1984} 1992}
1985 1993
1994
1986static int 1995static int
1987load_op_stop_set_property (struct GNUNET_ATS_TEST_Operation *o, 1996load_op_stop_set_property (struct GNUNET_ATS_TEST_Operation *o,
1988 struct Episode *e, 1997 struct Episode *e,
@@ -2078,6 +2087,7 @@ load_op_start_request (struct GNUNET_ATS_TEST_Operation *o,
2078 return GNUNET_OK; 2087 return GNUNET_OK;
2079} 2088}
2080 2089
2090
2081static int 2091static int
2082load_op_stop_request (struct GNUNET_ATS_TEST_Operation *o, 2092load_op_stop_request (struct GNUNET_ATS_TEST_Operation *o,
2083 struct Episode *e, 2093 struct Episode *e,
@@ -2205,6 +2215,7 @@ load_episode (struct Experiment *e, struct Episode *cur,
2205 return GNUNET_OK; 2215 return GNUNET_OK;
2206} 2216}
2207 2217
2218
2208static int 2219static int
2209load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) 2220load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg)
2210{ 2221{
@@ -2280,6 +2291,7 @@ timeout_experiment (void *cls)
2280 GNUNET_SYSERR); 2291 GNUNET_SYSERR);
2281} 2292}
2282 2293
2294
2283struct ATS_Address * 2295struct ATS_Address *
2284create_ats_address (const struct GNUNET_PeerIdentity *peer, 2296create_ats_address (const struct GNUNET_PeerIdentity *peer,
2285 const char *plugin_name, 2297 const char *plugin_name,
@@ -2309,7 +2321,6 @@ create_ats_address (const struct GNUNET_PeerIdentity *peer,
2309} 2321}
2310 2322
2311 2323
2312
2313static void 2324static void
2314enforce_add_address (struct GNUNET_ATS_TEST_Operation *op) 2325enforce_add_address (struct GNUNET_ATS_TEST_Operation *op)
2315{ 2326{
@@ -2413,6 +2424,7 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op)
2413 GNUNET_free (a); 2424 GNUNET_free (a);
2414} 2425}
2415 2426
2427
2416static void 2428static void
2417enforce_start_property (struct GNUNET_ATS_TEST_Operation *op) 2429enforce_start_property (struct GNUNET_ATS_TEST_Operation *op)
2418{ 2430{
@@ -2454,6 +2466,7 @@ enforce_start_property (struct GNUNET_ATS_TEST_Operation *op)
2454 op->prop_type); 2466 op->prop_type);
2455} 2467}
2456 2468
2469
2457static void 2470static void
2458enforce_stop_property (struct GNUNET_ATS_TEST_Operation *op) 2471enforce_stop_property (struct GNUNET_ATS_TEST_Operation *op)
2459{ 2472{
@@ -2477,6 +2490,7 @@ enforce_stop_property (struct GNUNET_ATS_TEST_Operation *op)
2477 } 2490 }
2478} 2491}
2479 2492
2493
2480static void 2494static void
2481enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op) 2495enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op)
2482{ 2496{
@@ -2509,6 +2523,7 @@ enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op)
2509 op->frequency); 2523 op->frequency);
2510} 2524}
2511 2525
2526
2512static void 2527static void
2513enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op) 2528enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op)
2514{ 2529{
@@ -2581,7 +2596,9 @@ enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op)
2581 } 2596 }
2582} 2597}
2583 2598
2584static void enforce_episode (struct Episode *ep) 2599
2600static void
2601enforce_episode (struct Episode *ep)
2585{ 2602{
2586 struct GNUNET_ATS_TEST_Operation *cur; 2603 struct GNUNET_ATS_TEST_Operation *cur;
2587 2604
@@ -2719,6 +2736,7 @@ GNUNET_ATS_solvers_experimentation_run (struct Experiment *e,
2719 enforce_episode (e->cur); 2736 enforce_episode (e->cur);
2720} 2737}
2721 2738
2739
2722void 2740void
2723GNUNET_ATS_solvers_experimentation_stop (struct Experiment *e) 2741GNUNET_ATS_solvers_experimentation_stop (struct Experiment *e)
2724{ 2742{
@@ -2872,7 +2890,6 @@ GNUNET_ATS_solvers_experimentation_load (char *filename)
2872} 2890}
2873 2891
2874 2892
2875
2876/** 2893/**
2877 * Solver 2894 * Solver
2878 */ 2895 */
@@ -2892,6 +2909,7 @@ free_all_it (void *cls,
2892 return GNUNET_OK; 2909 return GNUNET_OK;
2893} 2910}
2894 2911
2912
2895void 2913void
2896GNUNET_ATS_solvers_solver_stop (struct SolverHandle *sh) 2914GNUNET_ATS_solvers_solver_stop (struct SolverHandle *sh)
2897{ 2915{
@@ -3178,6 +3196,7 @@ solver_info_cb (void *cls,
3178 } 3196 }
3179} 3197}
3180 3198
3199
3181static void 3200static void
3182solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address) 3201solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address)
3183{ 3202{
@@ -3229,6 +3248,7 @@ solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address)
3229 return; 3248 return;
3230} 3249}
3231 3250
3251
3232const double * 3252const double *
3233get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id) 3253get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id)
3234{ 3254{
@@ -3385,6 +3405,7 @@ done ()
3385 end_now (); 3405 end_now ();
3386} 3406}
3387 3407
3408
3388static void 3409static void
3389experiment_done_cb (struct Experiment *e, struct GNUNET_TIME_Relative duration, 3410experiment_done_cb (struct Experiment *e, struct GNUNET_TIME_Relative duration,
3390 int success) 3411 int success)
@@ -3398,6 +3419,7 @@ experiment_done_cb (struct Experiment *e, struct GNUNET_TIME_Relative duration,
3398 GNUNET_SCHEDULER_add_now (&done, NULL); 3419 GNUNET_SCHEDULER_add_now (&done, NULL);
3399} 3420}
3400 3421
3422
3401static void 3423static void
3402episode_done_cb (struct Episode *ep) 3424episode_done_cb (struct Episode *ep)
3403{ 3425{
@@ -3405,7 +3427,6 @@ episode_done_cb (struct Episode *ep)
3405} 3427}
3406 3428
3407 3429
3408
3409/** 3430/**
3410 * Do shutdown 3431 * Do shutdown
3411 */ 3432 */
@@ -3424,6 +3445,7 @@ end_now ()
3424 } 3445 }
3425} 3446}
3426 3447
3448
3427static void 3449static void
3428run (void *cls, char *const *args, const char *cfgfile, 3450run (void *cls, char *const *args, const char *cfgfile,
3429 const struct GNUNET_CONFIGURATION_Handle *cfg) 3451 const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -3560,4 +3582,6 @@ main (int argc, char *argv[])
3560 3582
3561 return res; 3583 return res;
3562} 3584}
3585
3586
3563/* end of file ats-testing-experiment.c*/ 3587/* end of file ats-testing-experiment.c*/