diff options
-rw-r--r-- | src/ats/experiments/set_preference.exp | 3 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 74 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.h | 6 |
3 files changed, 46 insertions, 37 deletions
diff --git a/src/ats/experiments/set_preference.exp b/src/ats/experiments/set_preference.exp index f42efdcc5..dfbd75b18 100644 --- a/src/ats/experiments/set_preference.exp +++ b/src/ats/experiments/set_preference.exp | |||
@@ -63,8 +63,7 @@ op-1-base-rate= 10000 | |||
63 | op-1-max-rate = 20000 | 63 | op-1-max-rate = 20000 |
64 | op-1-period = 1000 ms | 64 | op-1-period = 1000 ms |
65 | op-1-frequency = 100 ms | 65 | op-1-frequency = 100 ms |
66 | # BANDWIDTH, LATENCY | 66 | op-1-prop = DELAY |
67 | op-1-pref = BANDWIDTH | ||
68 | 67 | ||
69 | [episode-2] | 68 | [episode-2] |
70 | # Shutdown | 69 | # Shutdown |
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 8776960fc..e0b0724ea 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -192,8 +192,11 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l) | |||
192 | log_p->peer_id = cur->peer_id; | 192 | log_p->peer_id = cur->peer_id; |
193 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) | 193 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) |
194 | { | 194 | { |
195 | log_p->pref_abs[c] = cur->pref_abs[c]; | ||
195 | log_p->pref_norm[c] = cur->pref_norm[c]; | 196 | log_p->pref_norm[c] = cur->pref_norm[c]; |
196 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t %s = %.2f\n", GNUNET_ATS_print_preference_type(c), log_p->pref_norm[c]); | 197 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t %s = %.2f %.2f [abs/rel]\n", |
198 | GNUNET_ATS_print_preference_type(c), | ||
199 | log_p->pref_abs[c], log_p->pref_norm[c]); | ||
197 | } | 200 | } |
198 | GNUNET_CONTAINER_DLL_insert_tail(lts->head, lts->tail, log_p); | 201 | GNUNET_CONTAINER_DLL_insert_tail(lts->head, lts->tail, log_p); |
199 | 202 | ||
@@ -208,8 +211,11 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l) | |||
208 | log_a->assigned_bw_out = cur_addr->ats_addr->assigned_bw_out; | 211 | log_a->assigned_bw_out = cur_addr->ats_addr->assigned_bw_out; |
209 | for (c = 0; c < GNUNET_ATS_PropertyCount; c++) | 212 | for (c = 0; c < GNUNET_ATS_PropertyCount; c++) |
210 | { | 213 | { |
214 | log_a->prop_abs[c] = cur_addr->prop_abs[c]; | ||
211 | log_a->prop_norm[c] = cur_addr->prop_norm[c]; | 215 | log_a->prop_norm[c] = cur_addr->prop_norm[c]; |
212 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t %s = %.2f\n", GNUNET_ATS_print_property_type(c), log_a->prop_norm[c]); | 216 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t %s = %.2f %.2f [abs/rel]\n", |
217 | GNUNET_ATS_print_property_type(c), | ||
218 | log_a->prop_abs[c], log_a->prop_norm[c]); | ||
213 | } | 219 | } |
214 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t Active = %i\n", log_a->active); | 220 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t Active = %i\n", log_a->active); |
215 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t BW in = %llu\n", ntohl(log_a->assigned_bw_in.value__)); | 221 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t BW in = %llu\n", ntohl(log_a->assigned_bw_in.value__)); |
@@ -275,7 +281,9 @@ GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l) | |||
275 | fprintf (stderr,"\tLogging peer id %u\n", log_p->id); | 281 | fprintf (stderr,"\tLogging peer id %u\n", log_p->id); |
276 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) | 282 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) |
277 | { | 283 | { |
278 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t %s = %.2f\n", GNUNET_ATS_print_preference_type(c), log_p->pref_norm[c]); | 284 | fprintf(stderr,"\t %s = %.2f %.2f [abs/rel]\n", |
285 | GNUNET_ATS_print_preference_type(c), | ||
286 | log_p->pref_abs[c], log_p->pref_norm[c]); | ||
279 | } | 287 | } |
280 | 288 | ||
281 | for (log_a = log_p->addr_head; NULL != log_a; log_a = log_a->next) | 289 | for (log_a = log_p->addr_head; NULL != log_a; log_a = log_a->next) |
@@ -287,7 +295,9 @@ GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l) | |||
287 | 295 | ||
288 | for (c = 0; c < GNUNET_ATS_PropertyCount; c++) | 296 | for (c = 0; c < GNUNET_ATS_PropertyCount; c++) |
289 | { | 297 | { |
290 | fprintf(stderr, "\t %s = %.2f\n", GNUNET_ATS_print_property_type(c), log_a->prop_norm[c]); | 298 | fprintf(stderr, "\t %s = %.2f %.2f [abs/rel]\n", |
299 | GNUNET_ATS_print_property_type(c), | ||
300 | log_a->prop_abs[c], log_a->prop_norm[c]); | ||
291 | } | 301 | } |
292 | } | 302 | } |
293 | } | 303 | } |
@@ -312,7 +322,6 @@ GNUNET_ATS_solver_logging_free (struct LoggingHandle *l) | |||
312 | while (NULL != (lts_cur = lts_next)) | 322 | while (NULL != (lts_cur = lts_next)) |
313 | { | 323 | { |
314 | lts_next = lts_cur->next; | 324 | lts_next = lts_cur->next; |
315 | GNUNET_CONTAINER_DLL_remove (l->head, l->tail, lts_cur); | ||
316 | 325 | ||
317 | log_p_next = lts_cur->head; | 326 | log_p_next = lts_cur->head; |
318 | while (NULL != (log_p_cur = log_p_next)) | 327 | while (NULL != (log_p_cur = log_p_next)) |
@@ -323,6 +332,7 @@ GNUNET_ATS_solver_logging_free (struct LoggingHandle *l) | |||
323 | while (NULL != (log_a_cur = log_a_next)) | 332 | while (NULL != (log_a_cur = log_a_next)) |
324 | { | 333 | { |
325 | log_a_next = log_a_cur->next; | 334 | log_a_next = log_a_cur->next; |
335 | |||
326 | GNUNET_CONTAINER_DLL_remove (log_p_cur->addr_head, log_p_cur->addr_tail, log_a_cur); | 336 | GNUNET_CONTAINER_DLL_remove (log_p_cur->addr_head, log_p_cur->addr_tail, log_a_cur); |
327 | GNUNET_free (log_a_cur); | 337 | GNUNET_free (log_a_cur); |
328 | } | 338 | } |
@@ -331,6 +341,7 @@ GNUNET_ATS_solver_logging_free (struct LoggingHandle *l) | |||
331 | GNUNET_free (log_p_cur); | 341 | GNUNET_free (log_p_cur); |
332 | } | 342 | } |
333 | 343 | ||
344 | GNUNET_CONTAINER_DLL_remove (l->head, l->tail, lts_cur); | ||
334 | GNUNET_free (lts_cur); | 345 | GNUNET_free (lts_cur); |
335 | } | 346 | } |
336 | 347 | ||
@@ -436,6 +447,7 @@ set_prop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
436 | } | 447 | } |
437 | 448 | ||
438 | pref_value = get_property (pg); | 449 | pref_value = get_property (pg); |
450 | a->prop_abs[pg->ats_property] = pref_value; | ||
439 | 451 | ||
440 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 452 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
441 | "Setting property for peer [%u] address [%u] for %s to %f\n", | 453 | "Setting property for peer [%u] address [%u] for %s to %f\n", |
@@ -456,15 +468,21 @@ set_prop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
456 | 468 | ||
457 | } | 469 | } |
458 | 470 | ||
471 | /** | ||
472 | * Set ats_property to 0 to find all pgs | ||
473 | */ | ||
474 | |||
459 | static struct PropertyGenerator * | 475 | static struct PropertyGenerator * |
460 | find_prop_gen (unsigned int peer, unsigned int address, | 476 | find_prop_gen (unsigned int peer, unsigned int address, |
461 | uint32_t ats_property) | 477 | uint32_t ats_property) |
462 | { | 478 | { |
463 | struct PropertyGenerator *cur; | 479 | struct PropertyGenerator *cur; |
464 | for (cur = prop_gen_head; NULL != cur; cur = cur->next) | 480 | for (cur = prop_gen_head; NULL != cur; cur = cur->next) |
465 | if ((cur->peer == peer) && (cur->address_id == address) && | 481 | if ((cur->peer == peer) && (cur->address_id == address)) |
466 | (cur->ats_property == ats_property)) | 482 | { |
467 | return cur; | 483 | if ((cur->ats_property == ats_property) || (0 == ats_property)) |
484 | return cur; | ||
485 | } | ||
468 | return NULL; | 486 | return NULL; |
469 | } | 487 | } |
470 | 488 | ||
@@ -674,10 +692,11 @@ set_pref_task (void *cls, | |||
674 | } | 692 | } |
675 | 693 | ||
676 | pref_value = get_preference (pg); | 694 | pref_value = get_preference (pg); |
695 | p->pref_abs[pg->kind] = pref_value; | ||
677 | 696 | ||
678 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 697 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
679 | "Setting preference for peer [%u] address [%u] for client %p pref %s to %f\n", | 698 | "Setting preference for peer [%u] for client %p pref %s to %f\n", |
680 | pg->peer, pg->address_id, NULL + (pg->client_id), | 699 | pg->peer, NULL + (pg->client_id), |
681 | GNUNET_ATS_print_preference_type (pg->kind), pref_value); | 700 | GNUNET_ATS_print_preference_type (pg->kind), pref_value); |
682 | 701 | ||
683 | sh->env.sf.s_bulk_start (sh->solver); | 702 | sh->env.sf.s_bulk_start (sh->solver); |
@@ -707,7 +726,7 @@ find_pref_gen (unsigned int peer, unsigned int address, | |||
707 | { | 726 | { |
708 | struct PreferenceGenerator *cur; | 727 | struct PreferenceGenerator *cur; |
709 | for (cur = pref_gen_head; NULL != cur; cur = cur->next) | 728 | for (cur = pref_gen_head; NULL != cur; cur = cur->next) |
710 | if ((cur->peer == peer) && (cur->address_id == address) && (cur->kind == kind)) | 729 | if ((cur->peer == peer) && (cur->kind == kind)) |
711 | return cur; | 730 | return cur; |
712 | return NULL; | 731 | return NULL; |
713 | } | 732 | } |
@@ -723,8 +742,8 @@ GNUNET_ATS_solver_generate_preferences_stop (struct PreferenceGenerator *pg) | |||
723 | pg->set_task = GNUNET_SCHEDULER_NO_TASK; | 742 | pg->set_task = GNUNET_SCHEDULER_NO_TASK; |
724 | } | 743 | } |
725 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 744 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
726 | "Removing old up preference generator peer [%u] address [%u] `%s'\n", | 745 | "Removing old up preference generator peer [%u] `%s'\n", |
727 | pg->peer, pg->address_id, GNUNET_ATS_print_preference_type(pg->kind)); | 746 | pg->peer, GNUNET_ATS_print_preference_type(pg->kind)); |
728 | 747 | ||
729 | GNUNET_free (pg); | 748 | GNUNET_free (pg); |
730 | } | 749 | } |
@@ -762,7 +781,6 @@ GNUNET_ATS_solver_generate_preferences_start (unsigned int peer, | |||
762 | GNUNET_CONTAINER_DLL_insert (pref_gen_head, pref_gen_tail, pg); | 781 | GNUNET_CONTAINER_DLL_insert (pref_gen_head, pref_gen_tail, pg); |
763 | pg->type = type; | 782 | pg->type = type; |
764 | pg->peer = peer; | 783 | pg->peer = peer; |
765 | pg->address_id = address_id; | ||
766 | pg->client_id = client_id; | 784 | pg->client_id = client_id; |
767 | pg->kind = kind; | 785 | pg->kind = kind; |
768 | pg->base_value = base_value; | 786 | pg->base_value = base_value; |
@@ -774,27 +792,27 @@ GNUNET_ATS_solver_generate_preferences_start (unsigned int peer, | |||
774 | switch (type) { | 792 | switch (type) { |
775 | case GNUNET_ATS_TEST_TG_CONSTANT: | 793 | case GNUNET_ATS_TEST_TG_CONSTANT: |
776 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 794 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
777 | "Setting up %s preference generator peer [%u] address [%u] `%s' max %u Bips\n", | 795 | "Setting up %s preference generator peer [%u] `%s' max %u Bips\n", |
778 | print_generator_type (type), pg->peer, pg->address_id, | 796 | print_generator_type (type), pg->peer, |
779 | GNUNET_ATS_print_preference_type(kind), | 797 | GNUNET_ATS_print_preference_type(kind), |
780 | base_value); | 798 | base_value); |
781 | break; | 799 | break; |
782 | case GNUNET_ATS_TEST_TG_LINEAR: | 800 | case GNUNET_ATS_TEST_TG_LINEAR: |
783 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 801 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
784 | "Setting up %s preference generator peer [%u] address [%u] `%s' min %u Bips max %u Bips\n", | 802 | "Setting up %s preference generator peer [%u] `%s' min %u Bips max %u Bips\n", |
785 | print_generator_type (type), pg->peer, pg->address_id, GNUNET_ATS_print_preference_type(kind), | 803 | print_generator_type (type), pg->peer, GNUNET_ATS_print_preference_type(kind), |
786 | base_value, value_rate); | 804 | base_value, value_rate); |
787 | break; | 805 | break; |
788 | case GNUNET_ATS_TEST_TG_SINUS: | 806 | case GNUNET_ATS_TEST_TG_SINUS: |
789 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 807 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
790 | "Setting up %s preference generator peer [%u] address [%u] `%s' baserate %u Bips, amplitude %u Bps\n", | 808 | "Setting up %s preference generator peer [%u] `%s' baserate %u Bips, amplitude %u Bps\n", |
791 | print_generator_type (type), pg->peer, pg->address_id, GNUNET_ATS_print_preference_type(kind), | 809 | print_generator_type (type), pg->peer, GNUNET_ATS_print_preference_type(kind), |
792 | base_value, value_rate); | 810 | base_value, value_rate); |
793 | break; | 811 | break; |
794 | case GNUNET_ATS_TEST_TG_RANDOM: | 812 | case GNUNET_ATS_TEST_TG_RANDOM: |
795 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 813 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
796 | "Setting up %s preference generator peer [%u] address [%u] `%s' min %u Bips max %u Bps\n", | 814 | "Setting up %s preference generator peer [%u] `%s' min %u Bips max %u Bps\n", |
797 | print_generator_type (type), pg->peer, pg->address_id, GNUNET_ATS_print_preference_type(kind), | 815 | print_generator_type (type), pg->peer, GNUNET_ATS_print_preference_type(kind), |
798 | base_value, value_rate); | 816 | base_value, value_rate); |
799 | break; | 817 | break; |
800 | default: | 818 | default: |
@@ -1108,18 +1126,6 @@ load_op_start_set_preference (struct GNUNET_ATS_TEST_Operation *o, | |||
1108 | GNUNET_free (op_name); | 1126 | GNUNET_free (op_name); |
1109 | 1127 | ||
1110 | /* address id */ | 1128 | /* address id */ |
1111 | GNUNET_asprintf(&op_name, "op-%u-address-id", op_counter); | ||
1112 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, | ||
1113 | sec_name, op_name, &o->address_id)) | ||
1114 | { | ||
1115 | fprintf (stderr, "Missing address-id in operation %u `%s' in episode `%s'\n", | ||
1116 | op_counter, "START_SET_PREFERENCE", op_name); | ||
1117 | GNUNET_free (op_name); | ||
1118 | return GNUNET_SYSERR; | ||
1119 | } | ||
1120 | GNUNET_free (op_name); | ||
1121 | |||
1122 | /* address id */ | ||
1123 | GNUNET_asprintf(&op_name, "op-%u-client-id", op_counter); | 1129 | GNUNET_asprintf(&op_name, "op-%u-client-id", op_counter); |
1124 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, | 1130 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, |
1125 | sec_name, op_name, &o->client_id)) | 1131 | sec_name, op_name, &o->client_id)) |
diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h index 9463fcbe9..3d26afcd9 100644 --- a/src/ats/gnunet-ats-solver-eval.h +++ b/src/ats/gnunet-ats-solver-eval.h | |||
@@ -104,6 +104,7 @@ struct LoggingPeer | |||
104 | 104 | ||
105 | int id; | 105 | int id; |
106 | struct GNUNET_PeerIdentity peer_id; | 106 | struct GNUNET_PeerIdentity peer_id; |
107 | double pref_abs[GNUNET_ATS_PreferenceCount]; | ||
107 | double pref_norm[GNUNET_ATS_PreferenceCount]; | 108 | double pref_norm[GNUNET_ATS_PreferenceCount]; |
108 | 109 | ||
109 | struct LoggingAddress *addr_head; | 110 | struct LoggingAddress *addr_head; |
@@ -122,6 +123,7 @@ struct LoggingAddress | |||
122 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in; | 123 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in; |
123 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out; | 124 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out; |
124 | 125 | ||
126 | double prop_abs[GNUNET_ATS_PropertyCount]; | ||
125 | double prop_norm[GNUNET_ATS_PropertyCount]; | 127 | double prop_norm[GNUNET_ATS_PropertyCount]; |
126 | }; | 128 | }; |
127 | 129 | ||
@@ -133,6 +135,8 @@ struct TestPeer | |||
133 | 135 | ||
134 | int id; | 136 | int id; |
135 | struct GNUNET_PeerIdentity peer_id; | 137 | struct GNUNET_PeerIdentity peer_id; |
138 | |||
139 | double pref_abs[GNUNET_ATS_PreferenceCount]; | ||
136 | double pref_norm[GNUNET_ATS_PreferenceCount]; | 140 | double pref_norm[GNUNET_ATS_PreferenceCount]; |
137 | 141 | ||
138 | struct TestAddress *addr_head; | 142 | struct TestAddress *addr_head; |
@@ -148,6 +152,7 @@ struct TestAddress | |||
148 | int aid; | 152 | int aid; |
149 | struct ATS_Address *ats_addr; | 153 | struct ATS_Address *ats_addr; |
150 | 154 | ||
155 | double prop_abs[GNUNET_ATS_PropertyCount]; | ||
151 | double prop_norm[GNUNET_ATS_PropertyCount]; | 156 | double prop_norm[GNUNET_ATS_PropertyCount]; |
152 | }; | 157 | }; |
153 | 158 | ||
@@ -238,7 +243,6 @@ struct PreferenceGenerator | |||
238 | enum GeneratorType type; | 243 | enum GeneratorType type; |
239 | 244 | ||
240 | unsigned int peer; | 245 | unsigned int peer; |
241 | unsigned int address_id; | ||
242 | unsigned int client_id; | 246 | unsigned int client_id; |
243 | 247 | ||
244 | enum GNUNET_ATS_PreferenceKind kind; | 248 | enum GNUNET_ATS_PreferenceKind kind; |