diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-02-11 13:28:06 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-02-11 13:28:06 +0000 |
commit | a5b4af52529d598adc78ae86621f8803d12eef8f (patch) | |
tree | 4a99ade1ed3571ac8044db9e2d698001df7efe41 /src | |
parent | 10bc3b99a7d8a19d8a924e93da842c1aba40cfe4 (diff) | |
download | gnunet-a5b4af52529d598adc78ae86621f8803d12eef8f.tar.gz gnunet-a5b4af52529d598adc78ae86621f8803d12eef8f.zip |
properties
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/experiments/example.exp | 118 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 105 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.h | 2 |
3 files changed, 132 insertions, 93 deletions
diff --git a/src/ats/experiments/example.exp b/src/ats/experiments/example.exp index bfedcf262..ac7e85889 100644 --- a/src/ats/experiments/example.exp +++ b/src/ats/experiments/example.exp | |||
@@ -1,71 +1,113 @@ | |||
1 | [experiment] | 1 | [experiment] |
2 | name = test | 2 | name = test |
3 | masters = 1 | ||
4 | slaves = 2 | ||
5 | max_duration = 15 s | 3 | max_duration = 15 s |
6 | log_freq = 1000 ms | 4 | log_freq = 1000 ms |
7 | cfg_file = experiments/gnunet_ats_sim_default.conf | 5 | cfg_file = experiments/gnunet_ats_sim_default.conf |
8 | 6 | ||
7 | |||
9 | [episode-0] | 8 | [episode-0] |
9 | # Setup addresses | ||
10 | |||
10 | # operations = address_add, address_del, start_set_property, stop_set_property, | 11 | # operations = address_add, address_del, start_set_property, stop_set_property, |
11 | # start_set_preference, stop_preference, start_request, stop_request | 12 | # start_set_preference, stop_preference, start_request, stop_request |
12 | duration = 2 s | 13 | duration = 5 s |
13 | op-0-operation = address_add | 14 | op-0-operation = address_add |
14 | op-0-address-id = 0 | 15 | op-0-address-id = 0 |
15 | op-0-peer-id = 0 | 16 | op-0-peer-id = 0 |
16 | op-0-address-session = 0 | 17 | op-0-address-session = 0 |
17 | op-0-address-network = 0 | 18 | op-0-address-network = 0 |
18 | op-0-address = 0_0_udp | 19 | op-0-address = 0_0_test |
19 | op-0-plugin = udp | 20 | op-0-plugin = test |
20 | 21 | ||
21 | #op-1-operation = start_set_preference | 22 | op-1-operation = address_add |
22 | #op-1-address-id = 1 | 23 | op-1-address-id = 1 |
23 | #op-1-peer-id = 1 | 24 | op-1-peer-id = 1 |
24 | # constant, linear, sinus, random | 25 | op-1-address-session = 0 |
25 | #op-1-gen-type = constant | 26 | op-1-address-network = 0 |
26 | #op-1-base-rate= 10000 | 27 | op-1-address = 1_1_test |
27 | #op-1-max-rate = 100000 | 28 | op-1-plugin = test |
28 | #op-1-frequency = 500 ms | ||
29 | # BANDWIDTH, LATENCY | ||
30 | #op-1-pref = BANDWIDTH | ||
31 | 29 | ||
32 | op-1-operation = start_request | 30 | op-2-operation = start_request |
33 | op-1-peer-id = 0 | 31 | op-2-peer-id = 0 |
34 | 32 | ||
33 | op-3-operation = start_request | ||
34 | op-3-peer-id = 1 | ||
35 | 35 | ||
36 | op-2-operation = start_set_property | 36 | [episode-1] |
37 | op-2-address-id = 0 | 37 | # Set delay |
38 | op-2-peer-id = 0 | 38 | duration = 5 s |
39 | |||
40 | op-0-operation = start_set_property | ||
41 | op-0-address-id = 0 | ||
42 | op-0-peer-id = 0 | ||
43 | # constant, linear, sinus, random | ||
44 | op-0-gen-type = random | ||
45 | op-0-base-rate= 10000 | ||
46 | op-0-max-rate = 20000 | ||
47 | op-0-frequency = 1000 ms | ||
48 | # bandwidth, latency | ||
49 | # "TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", "UTILIZATION_PAYLOAD_UP", "UTILIZATION_PAYLOAD_DOWN", "NETWORK_TYPE", "DELAY", "DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN" | ||
50 | op-0-property = DELAY | ||
51 | |||
52 | op-1-operation = start_set_property | ||
53 | op-1-address-id = 1 | ||
54 | op-1-peer-id = 1 | ||
39 | # constant, linear, sinus, random | 55 | # constant, linear, sinus, random |
40 | op-2-gen-type = constant | 56 | op-1-gen-type = constant |
41 | op-2-base-rate= 10000 | 57 | op-1-base-rate= 1 |
42 | op-2-max-rate = 100000 | 58 | op-1-max-rate = 1 |
43 | op-2-frequency = 500 ms | 59 | op-1-frequency = 1000 ms |
44 | # bandwidth, latency | 60 | # bandwidth, latency |
45 | # "TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", "UTILIZATION_PAYLOAD_UP", "UTILIZATION_PAYLOAD_DOWN", "NETWORK_TYPE", "DELAY", "DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN" | 61 | # "TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", "UTILIZATION_PAYLOAD_UP", "UTILIZATION_PAYLOAD_DOWN", "NETWORK_TYPE", "DELAY", "DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN" |
46 | op-2-property = UTILIZATION_UP | 62 | op-1-property = DELAY |
47 | 63 | ||
48 | 64 | ||
49 | [episode-1] | 65 | [episode-2] |
66 | # Shutdown | ||
50 | duration = 2 s | 67 | duration = 2 s |
51 | 68 | op-0-operation = stop_set_property | |
52 | op-0-operation = address_del | ||
53 | op-0-address-id = 0 | 69 | op-0-address-id = 0 |
54 | op-0-peer-id = 0 | 70 | op-0-peer-id = 0 |
55 | op-0-address-session = 0 | 71 | op-0-property = DELAY |
56 | op-0-address-network = 0 | ||
57 | op-0-address = 0_0_udp | ||
58 | op-0-plugin = udp | ||
59 | 72 | ||
60 | op-1-operation = stop_set_preference | 73 | op-1-operation = stop_set_property |
61 | op-1-address-id = 1 | 74 | op-1-address-id = 1 |
62 | op-1-peer-id = 1 | 75 | op-1-peer-id = 1 |
63 | op-1-pref = BANDWIDTH | 76 | op-1-property = DELAY |
77 | |||
78 | [episode-3] | ||
79 | # Shutdown | ||
80 | duration = 2 s | ||
81 | |||
82 | op-0-operation = stop_request | ||
83 | op-0-peer-id = 0 | ||
64 | 84 | ||
65 | op-2-operation = stop_set_property | 85 | op-1-operation = stop_request |
86 | op-1-peer-id = 1 | ||
87 | |||
88 | op-2-operation = address_del | ||
66 | op-2-address-id = 0 | 89 | op-2-address-id = 0 |
67 | op-2-peer-id = 0 | 90 | op-2-peer-id = 0 |
68 | op-2-property = UTILIZATION_UP | 91 | op-2-address-session = 0 |
92 | op-2-address-network = 0 | ||
93 | op-2-address = 0_0_test | ||
94 | op-2-plugin = test | ||
95 | |||
96 | op-2-operation = address_del | ||
97 | op-2-address-id = 1 | ||
98 | op-2-peer-id = 1 | ||
99 | op-2-address-session = 0 | ||
100 | op-2-address-network = 0 | ||
101 | op-2-address = 1_1_test | ||
102 | op-2-plugin = test | ||
69 | 103 | ||
70 | op-3-operation = stop_request | 104 | #op-1-operation = start_set_preference |
71 | op-3-peer-id = 0 \ No newline at end of file | 105 | #op-1-address-id = 1 |
106 | #op-1-peer-id = 1 | ||
107 | # constant, linear, sinus, random | ||
108 | #op-1-gen-type = constant | ||
109 | #op-1-base-rate= 10000 | ||
110 | #op-1-max-rate = 100000 | ||
111 | #op-1-frequency = 500 ms | ||
112 | # BANDWIDTH, LATENCY | ||
113 | #op-1-pref = BANDWIDTH \ No newline at end of file | ||
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 0e0c5bb9f..234492962 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -274,7 +274,8 @@ set_prop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
274 | { | 274 | { |
275 | GNUNET_break (0); | 275 | GNUNET_break (0); |
276 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 276 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
277 | "Setting property generation for unknown address %u\n", pg->address_id); | 277 | "Setting property generation for unknown address [%u:%u]\n", |
278 | pg->peer, pg->address_id); | ||
278 | return; | 279 | return; |
279 | } | 280 | } |
280 | 281 | ||
@@ -286,8 +287,8 @@ set_prop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
286 | GNUNET_ATS_print_property_type (pg->ats_property), pref_value); | 287 | GNUNET_ATS_print_property_type (pg->ats_property), pref_value); |
287 | 288 | ||
288 | 289 | ||
289 | atsi.type = pg->ats_property; | 290 | atsi.type = htonl (pg->ats_property); |
290 | atsi.value = (uint32_t) pref_value; | 291 | atsi.value = htonl ((uint32_t) pref_value); |
291 | 292 | ||
292 | /* set performance here! */ | 293 | /* set performance here! */ |
293 | sh->env.sf.s_bulk_start (sh->solver); | 294 | sh->env.sf.s_bulk_start (sh->solver); |
@@ -701,8 +702,6 @@ create_experiment () | |||
701 | struct Experiment *e; | 702 | struct Experiment *e; |
702 | e = GNUNET_new (struct Experiment); | 703 | e = GNUNET_new (struct Experiment); |
703 | e->name = NULL; | 704 | e->name = NULL; |
704 | e->num_masters = 0; | ||
705 | e->num_slaves = 0; | ||
706 | e->start = NULL; | 705 | e->start = NULL; |
707 | e->total_duration = GNUNET_TIME_UNIT_ZERO; | 706 | e->total_duration = GNUNET_TIME_UNIT_ZERO; |
708 | return e; | 707 | return e; |
@@ -1545,6 +1544,7 @@ load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1545 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time(cfg, | 1544 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time(cfg, |
1546 | sec_name, "duration", &e_duration)) | 1545 | sec_name, "duration", &e_duration)) |
1547 | { | 1546 | { |
1547 | fprintf (stderr, "Missing duration in episode %u \n",e_counter); | ||
1548 | GNUNET_free (sec_name); | 1548 | GNUNET_free (sec_name); |
1549 | break; | 1549 | break; |
1550 | } | 1550 | } |
@@ -1571,7 +1571,7 @@ load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1571 | if (NULL == last) | 1571 | if (NULL == last) |
1572 | e->start = cur; | 1572 | e->start = cur; |
1573 | else | 1573 | else |
1574 | last->next = cur; | 1574 | last->next = cur; |
1575 | 1575 | ||
1576 | GNUNET_free (sec_name); | 1576 | GNUNET_free (sec_name); |
1577 | e_counter ++; | 1577 | e_counter ++; |
@@ -2018,28 +2018,6 @@ GNUNET_ATS_solvers_experimentation_load (char *filename) | |||
2018 | 2018 | ||
2019 | } | 2019 | } |
2020 | 2020 | ||
2021 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number(cfg, "experiment", | ||
2022 | "masters", &e->num_masters)) | ||
2023 | { | ||
2024 | fprintf (stderr, "Invalid %s", "masters"); | ||
2025 | free_experiment (e); | ||
2026 | return NULL; | ||
2027 | } | ||
2028 | else | ||
2029 | fprintf (stderr, "Experiment masters: `%llu'\n", | ||
2030 | e->num_masters); | ||
2031 | |||
2032 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number(cfg, "experiment", | ||
2033 | "slaves", &e->num_slaves)) | ||
2034 | { | ||
2035 | fprintf (stderr, "Invalid %s", "slaves"); | ||
2036 | free_experiment (e); | ||
2037 | return NULL; | ||
2038 | } | ||
2039 | else | ||
2040 | fprintf (stderr, "Experiment slaves: `%llu'\n", | ||
2041 | e->num_slaves); | ||
2042 | |||
2043 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time(cfg, "experiment", | 2021 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time(cfg, "experiment", |
2044 | "log_freq", &e->log_freq)) | 2022 | "log_freq", &e->log_freq)) |
2045 | { | 2023 | { |
@@ -2078,16 +2056,31 @@ GNUNET_ATS_solvers_experimentation_load (char *filename) | |||
2078 | return e; | 2056 | return e; |
2079 | } | 2057 | } |
2080 | 2058 | ||
2059 | |||
2060 | |||
2081 | /** | 2061 | /** |
2082 | * Solver | 2062 | * Solver |
2083 | */ | 2063 | */ |
2084 | 2064 | ||
2065 | static int | ||
2066 | free_all_it (void *cls, | ||
2067 | const struct GNUNET_PeerIdentity *key, | ||
2068 | void *value) | ||
2069 | { | ||
2070 | struct ATS_Address *address = value; | ||
2071 | GNUNET_CONTAINER_multipeermap_remove (sh->env.addresses, key, value); | ||
2072 | GNUNET_free (address); | ||
2073 | |||
2074 | return GNUNET_OK; | ||
2075 | } | ||
2076 | |||
2085 | void | 2077 | void |
2086 | GNUNET_ATS_solvers_solver_stop (struct SolverHandle *sh) | 2078 | GNUNET_ATS_solvers_solver_stop (struct SolverHandle *sh) |
2087 | { | 2079 | { |
2088 | GNUNET_STATISTICS_destroy ((struct GNUNET_STATISTICS_Handle *) sh->env.stats, | 2080 | GNUNET_STATISTICS_destroy ((struct GNUNET_STATISTICS_Handle *) sh->env.stats, |
2089 | GNUNET_NO); | 2081 | GNUNET_NO); |
2090 | GNUNET_PLUGIN_unload (sh->plugin, sh->solver); | 2082 | GNUNET_PLUGIN_unload (sh->plugin, sh->solver); |
2083 | GNUNET_CONTAINER_multipeermap_iterate (sh->addresses, &free_all_it, NULL); | ||
2091 | GNUNET_CONTAINER_multipeermap_destroy(sh->addresses); | 2084 | GNUNET_CONTAINER_multipeermap_destroy(sh->addresses); |
2092 | GNUNET_free (sh->plugin); | 2085 | GNUNET_free (sh->plugin); |
2093 | GNUNET_free (sh); | 2086 | GNUNET_free (sh); |
@@ -2330,10 +2323,15 @@ get_property_cb (void *cls, const struct ATS_Address *address) | |||
2330 | } | 2323 | } |
2331 | 2324 | ||
2332 | static void | 2325 | static void |
2333 | normalized_property_changed_cb (void *cls, struct ATS_Address *peer, | 2326 | normalized_property_changed_cb (void *cls, struct ATS_Address *address, |
2334 | uint32_t type, double prop_rel) | 2327 | uint32_t type, double prop_rel) |
2335 | { | 2328 | { |
2336 | /* TODO */ | 2329 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
2330 | "Normalized property %s for peer `%s' changed to %.3f \n", | ||
2331 | GNUNET_ATS_print_property_type (type), GNUNET_i2s (&address->peer), | ||
2332 | prop_rel); | ||
2333 | |||
2334 | sh->env.sf.s_address_update_property (sh->solver, address, type, 0, prop_rel); | ||
2337 | } | 2335 | } |
2338 | 2336 | ||
2339 | 2337 | ||
@@ -2402,27 +2400,25 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) | |||
2402 | return sh; | 2400 | return sh; |
2403 | } | 2401 | } |
2404 | 2402 | ||
2405 | static int | ||
2406 | free_all_it (void *cls, | ||
2407 | const struct GNUNET_PeerIdentity *key, | ||
2408 | void *value) | ||
2409 | { | ||
2410 | struct ATS_Address *address = value; | ||
2411 | GNUNET_CONTAINER_multipeermap_remove (sh->env.addresses, key, value); | ||
2412 | GNUNET_free (address); | ||
2413 | |||
2414 | return GNUNET_OK; | ||
2415 | } | ||
2416 | |||
2417 | static void | 2403 | static void |
2418 | done () | 2404 | done () |
2419 | { | 2405 | { |
2420 | struct TestPeer *cur; | 2406 | struct TestPeer *cur; |
2421 | struct TestPeer *next; | 2407 | struct TestPeer *next; |
2422 | /* Clean up experiment */ | 2408 | |
2409 | struct TestAddress *cur_a; | ||
2410 | struct TestAddress *next_a; | ||
2411 | |||
2412 | /* Stop logging */ | ||
2413 | GNUNET_ATS_solver_logging_stop (l); | ||
2414 | |||
2415 | /* Stop all preference generation */ | ||
2423 | GNUNET_ATS_solver_generate_preferences_stop_all (); | 2416 | GNUNET_ATS_solver_generate_preferences_stop_all (); |
2417 | |||
2418 | /* Stop all property generation */ | ||
2424 | GNUNET_ATS_solver_generate_property_stop_all (); | 2419 | GNUNET_ATS_solver_generate_property_stop_all (); |
2425 | 2420 | ||
2421 | /* Clean up experiment */ | ||
2426 | if (NULL != e) | 2422 | if (NULL != e) |
2427 | { | 2423 | { |
2428 | GNUNET_ATS_solvers_experimentation_stop (e); | 2424 | GNUNET_ATS_solvers_experimentation_stop (e); |
@@ -2440,10 +2436,21 @@ done () | |||
2440 | { | 2436 | { |
2441 | next = cur->next; | 2437 | next = cur->next; |
2442 | GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, cur); | 2438 | GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, cur); |
2443 | GNUNET_CONTAINER_multipeermap_iterate (sh->env.addresses, &free_all_it, NULL); | 2439 | next_a = cur->addr_head; |
2444 | 2440 | while (NULL != (cur_a = next_a)) | |
2441 | { | ||
2442 | next_a = cur_a->next; | ||
2443 | GNUNET_CONTAINER_DLL_remove (cur->addr_head, cur->addr_tail, cur_a); | ||
2444 | GNUNET_free (cur_a); | ||
2445 | } | ||
2445 | GNUNET_free (cur); | 2446 | GNUNET_free (cur); |
2446 | } | 2447 | } |
2448 | |||
2449 | if (NULL != sh) | ||
2450 | { | ||
2451 | GNUNET_ATS_solvers_solver_stop (sh); | ||
2452 | sh = NULL; | ||
2453 | } | ||
2447 | /* Shutdown */ | 2454 | /* Shutdown */ |
2448 | end_now(); | 2455 | end_now(); |
2449 | 2456 | ||
@@ -2458,14 +2465,6 @@ experiment_done_cb (struct Experiment *e, struct GNUNET_TIME_Relative duration,i | |||
2458 | else | 2465 | else |
2459 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment failed \n"); | 2466 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment failed \n"); |
2460 | 2467 | ||
2461 | /* Stop logging */ | ||
2462 | GNUNET_ATS_solver_logging_stop (l); | ||
2463 | |||
2464 | /* Stop traffic generation */ | ||
2465 | // GNUNET_ATS_TEST_generate_traffic_stop_all(); | ||
2466 | |||
2467 | /* Stop all preference generations */ | ||
2468 | GNUNET_ATS_solver_generate_preferences_stop_all (); | ||
2469 | 2468 | ||
2470 | /* | 2469 | /* |
2471 | evaluate (duration); | 2470 | evaluate (duration); |
diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h index 57cca782d..fe84674ac 100644 --- a/src/ats/gnunet-ats-solver-eval.h +++ b/src/ats/gnunet-ats-solver-eval.h | |||
@@ -162,8 +162,6 @@ struct Experiment | |||
162 | { | 162 | { |
163 | char *name; | 163 | char *name; |
164 | char *cfg_file; | 164 | char *cfg_file; |
165 | unsigned long long int num_masters; | ||
166 | unsigned long long int num_slaves; | ||
167 | struct GNUNET_TIME_Relative log_freq; | 165 | struct GNUNET_TIME_Relative log_freq; |
168 | struct GNUNET_TIME_Relative max_duration; | 166 | struct GNUNET_TIME_Relative max_duration; |
169 | struct GNUNET_TIME_Relative total_duration; | 167 | struct GNUNET_TIME_Relative total_duration; |