diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-16 12:32:44 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-16 12:32:44 +0000 |
commit | 369811cfb47a51f240c7c4872e29c6eccd21fb0c (patch) | |
tree | 5db0ebec52759d4007f73ea5f1e5b4b0bd842afb /src/ats | |
parent | a523a1d723acb1544bf2066dbe63fe5e2a07f71b (diff) | |
download | gnunet-369811cfb47a51f240c7c4872e29c6eccd21fb0c.tar.gz gnunet-369811cfb47a51f240c7c4872e29c6eccd21fb0c.zip |
setting feedback with preference generator
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/experiments/set_preference.exp | 5 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 212 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.h | 24 |
3 files changed, 224 insertions, 17 deletions
diff --git a/src/ats/experiments/set_preference.exp b/src/ats/experiments/set_preference.exp index 5e651dc25..34f9af296 100644 --- a/src/ats/experiments/set_preference.exp +++ b/src/ats/experiments/set_preference.exp | |||
@@ -12,7 +12,7 @@ cfg_file = experiments/gnunet_ats_sim_default.conf | |||
12 | 12 | ||
13 | # operations = address_add, address_del, start_set_property, stop_set_property, | 13 | # operations = address_add, address_del, start_set_property, stop_set_property, |
14 | # start_set_preference, stop_preference, start_request, stop_request | 14 | # start_set_preference, stop_preference, start_request, stop_request |
15 | duration = 2 s | 15 | duration = 1 s |
16 | 16 | ||
17 | op-0-operation = address_add | 17 | op-0-operation = address_add |
18 | op-0-address-id = 0 | 18 | op-0-address-id = 0 |
@@ -38,7 +38,7 @@ op-3-peer-id = 1 | |||
38 | 38 | ||
39 | [episode-1] | 39 | [episode-1] |
40 | # Set delay | 40 | # Set delay |
41 | duration = 10 s | 41 | duration = 20 s |
42 | 42 | ||
43 | op-0-operation = start_set_preference | 43 | op-0-operation = start_set_preference |
44 | op-0-address-id = 0 | 44 | op-0-address-id = 0 |
@@ -50,6 +50,7 @@ op-0-base-rate= 1000 | |||
50 | op-0-max-rate = 10000 | 50 | op-0-max-rate = 10000 |
51 | op-0-period = 10 s | 51 | op-0-period = 10 s |
52 | op-0-frequency = 500 ms | 52 | op-0-frequency = 500 ms |
53 | op-0-feedback_delay = 500 ms | ||
53 | # BANDWIDTH, LATENCY | 54 | # BANDWIDTH, LATENCY |
54 | op-0-pref = BANDWIDTH | 55 | op-0-pref = BANDWIDTH |
55 | 56 | ||
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 07c818991..9028e6294 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -78,6 +78,8 @@ static int res; | |||
78 | static void | 78 | static void |
79 | end_now (); | 79 | end_now (); |
80 | 80 | ||
81 | const double * | ||
82 | get_property_cb (void *cls, const struct ATS_Address *address); | ||
81 | 83 | ||
82 | static char * | 84 | static char * |
83 | print_generator_type (enum GeneratorType g) | 85 | print_generator_type (enum GeneratorType g) |
@@ -880,6 +882,76 @@ get_preference (struct PreferenceGenerator *pg) | |||
880 | return pref_value; | 882 | return pref_value; |
881 | } | 883 | } |
882 | 884 | ||
885 | static void | ||
886 | set_feedback_task (void *cls, | ||
887 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
888 | { | ||
889 | struct PreferenceGenerator *pg = cls; | ||
890 | struct TestPeer *p; | ||
891 | double feedback; | ||
892 | uint32_t bw_acc_out; | ||
893 | uint32_t bw_acc_in; | ||
894 | uint32_t delay_acc_in; | ||
895 | struct GNUNET_TIME_Relative dur; | ||
896 | double p_new; | ||
897 | |||
898 | pg->feedback_task = GNUNET_SCHEDULER_NO_TASK; | ||
899 | |||
900 | if (NULL == (p = find_peer_by_id (pg->peer))) | ||
901 | { | ||
902 | GNUNET_break (0); | ||
903 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
904 | "Setting feedback for unknown peer %u\n", pg->peer); | ||
905 | return; | ||
906 | } | ||
907 | |||
908 | switch (pg->kind) { | ||
909 | case GNUNET_ATS_PREFERENCE_BANDWIDTH: | ||
910 | dur = GNUNET_TIME_absolute_get_duration(pg->feedback_last_bw_update); | ||
911 | bw_acc_in = dur.rel_value_us *pg->last_assigned_bw_in + pg->feedback_bw_in_acc; | ||
912 | pg->feedback_bw_in_acc = 0; | ||
913 | |||
914 | bw_acc_out = dur.rel_value_us *pg->last_assigned_bw_out + pg->feedback_bw_out_acc; | ||
915 | p_new = get_preference (pg); | ||
916 | feedback = (p_new / pg->pref_bw_old) * (bw_acc_in + bw_acc_out) / | ||
917 | (2 *GNUNET_TIME_absolute_get_duration(pg->feedback_last).rel_value_us); | ||
918 | |||
919 | break; | ||
920 | case GNUNET_ATS_PREFERENCE_LATENCY: | ||
921 | dur = GNUNET_TIME_absolute_get_duration(pg->feedback_last_delay_update); | ||
922 | delay_acc_in =dur.rel_value_us *pg->last_delay_value + pg->feedback_delay_acc; | ||
923 | pg->feedback_delay_acc = 0; | ||
924 | |||
925 | p_new = get_preference (pg); | ||
926 | feedback = (p_new / pg->pref_latency_old) * (delay_acc_in) / | ||
927 | (GNUNET_TIME_absolute_get_duration(pg->feedback_last).rel_value_us); | ||
928 | |||
929 | break; | ||
930 | default: | ||
931 | break; | ||
932 | } | ||
933 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | ||
934 | "Giving feedback for peer [%u] for client %p pref %s of %.3f\n", | ||
935 | pg->peer, NULL + (pg->client_id), | ||
936 | GNUNET_ATS_print_preference_type (pg->kind), | ||
937 | feedback); | ||
938 | |||
939 | sh->env.sf.s_feedback (sh->solver, NULL + (pg->client_id), &p->peer_id, | ||
940 | pg->feedback_frequency, pg->kind, feedback); | ||
941 | pg->feedback_last = GNUNET_TIME_absolute_get(); | ||
942 | |||
943 | |||
944 | pg->feedback_bw_out_acc = 0; | ||
945 | pg->feedback_bw_in_acc = 0; | ||
946 | pg->feedback_last_bw_update = GNUNET_TIME_absolute_get(); | ||
947 | |||
948 | pg->feedback_delay_acc = 0; | ||
949 | pg->feedback_last_delay_update = GNUNET_TIME_absolute_get(); | ||
950 | |||
951 | |||
952 | pg->feedback_task = GNUNET_SCHEDULER_add_delayed (pg->feedback_frequency, | ||
953 | &set_feedback_task, pg); | ||
954 | } | ||
883 | 955 | ||
884 | static void | 956 | static void |
885 | set_pref_task (void *cls, | 957 | set_pref_task (void *cls, |
@@ -899,6 +971,17 @@ set_pref_task (void *cls, | |||
899 | } | 971 | } |
900 | 972 | ||
901 | pref_value = get_preference (pg); | 973 | pref_value = get_preference (pg); |
974 | switch (pg->kind) { | ||
975 | case GNUNET_ATS_PREFERENCE_BANDWIDTH: | ||
976 | pg->pref_bw_old = pref_value; | ||
977 | break; | ||
978 | case GNUNET_ATS_PREFERENCE_LATENCY: | ||
979 | pg->pref_latency_old = pref_value; | ||
980 | break; | ||
981 | default: | ||
982 | break; | ||
983 | } | ||
984 | |||
902 | p->pref_abs[pg->kind] = pref_value; | 985 | p->pref_abs[pg->kind] = pref_value; |
903 | 986 | ||
904 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 987 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
@@ -918,17 +1001,6 @@ set_pref_task (void *cls, | |||
918 | &p->peer_id, pg->kind, pref_value); | 1001 | &p->peer_id, pg->kind, pref_value); |
919 | sh->env.sf.s_bulk_stop (sh->solver); | 1002 | sh->env.sf.s_bulk_stop (sh->solver); |
920 | 1003 | ||
921 | switch (pg->kind) { | ||
922 | case GNUNET_ATS_PREFERENCE_BANDWIDTH: | ||
923 | //p->pref_bandwidth = pref_value; | ||
924 | break; | ||
925 | case GNUNET_ATS_PREFERENCE_LATENCY: | ||
926 | //p->pref_delay = pref_value; | ||
927 | break; | ||
928 | default: | ||
929 | break; | ||
930 | } | ||
931 | |||
932 | pg->set_task = GNUNET_SCHEDULER_add_delayed (pg->frequency, | 1004 | pg->set_task = GNUNET_SCHEDULER_add_delayed (pg->frequency, |
933 | set_pref_task, pg); | 1005 | set_pref_task, pg); |
934 | 1006 | ||
@@ -952,6 +1024,12 @@ GNUNET_ATS_solver_generate_preferences_stop (struct PreferenceGenerator *pg) | |||
952 | { | 1024 | { |
953 | GNUNET_CONTAINER_DLL_remove (pref_gen_head, pref_gen_tail, pg); | 1025 | GNUNET_CONTAINER_DLL_remove (pref_gen_head, pref_gen_tail, pg); |
954 | 1026 | ||
1027 | if (GNUNET_SCHEDULER_NO_TASK != pg->feedback_task) | ||
1028 | { | ||
1029 | GNUNET_SCHEDULER_cancel (pg->feedback_task); | ||
1030 | pg->feedback_task = GNUNET_SCHEDULER_NO_TASK; | ||
1031 | } | ||
1032 | |||
955 | if (GNUNET_SCHEDULER_NO_TASK != pg->set_task) | 1033 | if (GNUNET_SCHEDULER_NO_TASK != pg->set_task) |
956 | { | 1034 | { |
957 | GNUNET_SCHEDULER_cancel (pg->set_task); | 1035 | GNUNET_SCHEDULER_cancel (pg->set_task); |
@@ -964,6 +1042,15 @@ GNUNET_ATS_solver_generate_preferences_stop (struct PreferenceGenerator *pg) | |||
964 | GNUNET_free (pg); | 1042 | GNUNET_free (pg); |
965 | } | 1043 | } |
966 | 1044 | ||
1045 | struct TestAddress* | ||
1046 | find_active_address (struct TestPeer *p) | ||
1047 | { | ||
1048 | struct TestAddress *cur; | ||
1049 | for (cur = p->addr_head; NULL != cur; cur = cur->next) | ||
1050 | if (GNUNET_YES == cur->ats_addr->active) | ||
1051 | return cur; | ||
1052 | return NULL; | ||
1053 | } | ||
967 | 1054 | ||
968 | /** | 1055 | /** |
969 | * Generate between the source master and the partner and set property with a | 1056 | * Generate between the source master and the partner and set property with a |
@@ -989,9 +1076,19 @@ GNUNET_ATS_solver_generate_preferences_start (unsigned int peer, | |||
989 | long int value_rate, | 1076 | long int value_rate, |
990 | struct GNUNET_TIME_Relative period, | 1077 | struct GNUNET_TIME_Relative period, |
991 | struct GNUNET_TIME_Relative frequency, | 1078 | struct GNUNET_TIME_Relative frequency, |
992 | enum GNUNET_ATS_PreferenceKind kind) | 1079 | enum GNUNET_ATS_PreferenceKind kind, |
1080 | struct GNUNET_TIME_Relative feedback_frequency) | ||
993 | { | 1081 | { |
994 | struct PreferenceGenerator *pg; | 1082 | struct PreferenceGenerator *pg; |
1083 | struct TestPeer *p; | ||
1084 | |||
1085 | if (NULL == (p = find_peer_by_id (peer))) | ||
1086 | { | ||
1087 | GNUNET_break (0); | ||
1088 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1089 | "Starting preference for unknown peer %u\n", peer); | ||
1090 | return NULL; | ||
1091 | } | ||
995 | 1092 | ||
996 | pg = GNUNET_new (struct PreferenceGenerator); | 1093 | pg = GNUNET_new (struct PreferenceGenerator); |
997 | GNUNET_CONTAINER_DLL_insert (pref_gen_head, pref_gen_tail, pg); | 1094 | GNUNET_CONTAINER_DLL_insert (pref_gen_head, pref_gen_tail, pg); |
@@ -1004,6 +1101,7 @@ GNUNET_ATS_solver_generate_preferences_start (unsigned int peer, | |||
1004 | pg->duration_period = period; | 1101 | pg->duration_period = period; |
1005 | pg->frequency = frequency; | 1102 | pg->frequency = frequency; |
1006 | pg->time_start = GNUNET_TIME_absolute_get(); | 1103 | pg->time_start = GNUNET_TIME_absolute_get(); |
1104 | pg->feedback_frequency = feedback_frequency; | ||
1007 | 1105 | ||
1008 | switch (type) { | 1106 | switch (type) { |
1009 | case GNUNET_ATS_TEST_TG_CONSTANT: | 1107 | case GNUNET_ATS_TEST_TG_CONSTANT: |
@@ -1036,6 +1134,26 @@ GNUNET_ATS_solver_generate_preferences_start (unsigned int peer, | |||
1036 | } | 1134 | } |
1037 | 1135 | ||
1038 | pg->set_task = GNUNET_SCHEDULER_add_now (&set_pref_task, pg); | 1136 | pg->set_task = GNUNET_SCHEDULER_add_now (&set_pref_task, pg); |
1137 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != feedback_frequency.rel_value_us) | ||
1138 | { | ||
1139 | struct TestAddress * addr = find_active_address(p); | ||
1140 | const double *properties = get_property_cb (NULL, addr->ats_addr); | ||
1141 | |||
1142 | pg->last_assigned_bw_in = ntohl(p->assigned_bw_in.value__); | ||
1143 | pg->last_assigned_bw_out = ntohl(p->assigned_bw_out.value__); | ||
1144 | pg->feedback_bw_in_acc = 0; | ||
1145 | pg->feedback_bw_out_acc = 0; | ||
1146 | |||
1147 | pg->last_delay_value = properties[GNUNET_ATS_QUALITY_NET_DELAY]; | ||
1148 | pg->feedback_delay_acc = 0; | ||
1149 | |||
1150 | pg->feedback_last_bw_update = GNUNET_TIME_absolute_get(); | ||
1151 | pg->feedback_last_delay_update = GNUNET_TIME_absolute_get(); | ||
1152 | pg->feedback_last = GNUNET_TIME_absolute_get(); | ||
1153 | pg->feedback_task = GNUNET_SCHEDULER_add_delayed (feedback_frequency, | ||
1154 | &set_feedback_task, pg); | ||
1155 | } | ||
1156 | |||
1039 | return pg; | 1157 | return pg; |
1040 | } | 1158 | } |
1041 | 1159 | ||
@@ -1497,6 +1615,19 @@ load_op_start_set_preference (struct GNUNET_ATS_TEST_Operation *o, | |||
1497 | GNUNET_free (pref); | 1615 | GNUNET_free (pref); |
1498 | GNUNET_free (op_name); | 1616 | GNUNET_free (op_name); |
1499 | 1617 | ||
1618 | /* Get feedback delay */ | ||
1619 | GNUNET_asprintf(&op_name, "op-%u-feedback_delay", op_counter); | ||
1620 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (cfg, | ||
1621 | sec_name, op_name, &o->feedback_delay)) | ||
1622 | { | ||
1623 | fprintf (stderr, "Using feedback delay %llu in operation %u `%s' in episode %u\n", | ||
1624 | (long long unsigned int) o->feedback_delay.rel_value_us, | ||
1625 | op_counter, op_name, e->id); | ||
1626 | } | ||
1627 | else | ||
1628 | o->feedback_delay = GNUNET_TIME_UNIT_FOREVER_REL; | ||
1629 | GNUNET_free (op_name); | ||
1630 | |||
1500 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1631 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1501 | "Found operation %s: [%llu:%llu]: %s = %llu\n", | 1632 | "Found operation %s: [%llu:%llu]: %s = %llu\n", |
1502 | "START_SET_PREFERENCE", o->peer_id, o->address_id, | 1633 | "START_SET_PREFERENCE", o->peer_id, o->address_id, |
@@ -2066,6 +2197,8 @@ enforce_add_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2066 | { | 2197 | { |
2067 | p = GNUNET_new (struct TestPeer); | 2198 | p = GNUNET_new (struct TestPeer); |
2068 | p->id = op->peer_id; | 2199 | p->id = op->peer_id; |
2200 | p->assigned_bw_in = GNUNET_BANDWIDTH_value_init(0); | ||
2201 | p->assigned_bw_out = GNUNET_BANDWIDTH_value_init(0); | ||
2069 | memset (&p->peer_id, op->peer_id, sizeof (p->peer_id)); | 2202 | memset (&p->peer_id, op->peer_id, sizeof (p->peer_id)); |
2070 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) | 2203 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) |
2071 | { | 2204 | { |
@@ -2239,7 +2372,8 @@ enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op) | |||
2239 | op->max_rate, | 2372 | op->max_rate, |
2240 | op->period, | 2373 | op->period, |
2241 | op->frequency, | 2374 | op->frequency, |
2242 | op->pref_type); | 2375 | op->pref_type, |
2376 | op->frequency); | ||
2243 | } | 2377 | } |
2244 | 2378 | ||
2245 | static void | 2379 | static void |
@@ -2810,13 +2944,39 @@ solver_info_cb (void *cls, | |||
2810 | static void | 2944 | static void |
2811 | solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address) | 2945 | solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address) |
2812 | { | 2946 | { |
2947 | struct GNUNET_TIME_Relative duration; | ||
2948 | struct TestPeer *p; | ||
2949 | static struct PreferenceGenerator *pg; | ||
2950 | uint32_t delta; | ||
2813 | if ( (0 == ntohl (address->assigned_bw_out.value__)) && | 2951 | if ( (0 == ntohl (address->assigned_bw_out.value__)) && |
2814 | (0 == ntohl (address->assigned_bw_in.value__)) ) | 2952 | (0 == ntohl (address->assigned_bw_in.value__)) ) |
2815 | { | 2953 | { |
2816 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2954 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2817 | "Solver notified to disconnect peer `%s'\n", | 2955 | "Solver notified to disconnect peer `%s'\n", |
2818 | GNUNET_i2s (&address->peer)); | 2956 | GNUNET_i2s (&address->peer)); |
2957 | } | ||
2958 | p = find_peer_by_pid(&address->peer); | ||
2959 | if(NULL == p) | ||
2819 | return; | 2960 | return; |
2961 | p->assigned_bw_out = address->assigned_bw_out; | ||
2962 | p->assigned_bw_in = address->assigned_bw_in; | ||
2963 | |||
2964 | for (pg = pref_gen_head; NULL != pg; pg = pg->next) | ||
2965 | { | ||
2966 | if (pg->peer == p->id) | ||
2967 | { | ||
2968 | duration = GNUNET_TIME_absolute_get_duration(pg->feedback_last_bw_update); | ||
2969 | delta = duration.rel_value_us * pg->last_assigned_bw_out; | ||
2970 | //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "------> DELTA %u %u\n",delta, duration.rel_value_us); | ||
2971 | pg->feedback_bw_out_acc += delta; | ||
2972 | |||
2973 | delta = duration.rel_value_us * pg->last_assigned_bw_in; | ||
2974 | pg->feedback_bw_in_acc += delta; | ||
2975 | |||
2976 | pg->last_assigned_bw_in = ntohl (address->assigned_bw_in.value__); | ||
2977 | pg->last_assigned_bw_out = ntohl (address->assigned_bw_out.value__); | ||
2978 | pg->feedback_last_bw_update = GNUNET_TIME_absolute_get(); | ||
2979 | } | ||
2820 | } | 2980 | } |
2821 | 2981 | ||
2822 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2982 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -2825,8 +2985,6 @@ solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address) | |||
2825 | address, | 2985 | address, |
2826 | (unsigned int) ntohl (address->assigned_bw_out.value__), | 2986 | (unsigned int) ntohl (address->assigned_bw_out.value__), |
2827 | (unsigned int) ntohl (address->assigned_bw_in.value__)); | 2987 | (unsigned int) ntohl (address->assigned_bw_in.value__)); |
2828 | /*if (GNUNET_YES == ph.bulk_running) | ||
2829 | GNUNET_break (0);*/ | ||
2830 | if (NULL != l) | 2988 | if (NULL != l) |
2831 | GNUNET_ATS_solver_logging_now (l); | 2989 | GNUNET_ATS_solver_logging_now (l); |
2832 | 2990 | ||
@@ -2890,11 +3048,34 @@ static void | |||
2890 | normalized_property_changed_cb (void *cls, struct ATS_Address *address, | 3048 | normalized_property_changed_cb (void *cls, struct ATS_Address *address, |
2891 | uint32_t type, double prop_rel) | 3049 | uint32_t type, double prop_rel) |
2892 | { | 3050 | { |
3051 | struct TestPeer *p; | ||
3052 | struct PreferenceGenerator *pg; | ||
3053 | struct GNUNET_TIME_Relative duration; | ||
3054 | uint32_t delta; | ||
3055 | |||
2893 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 3056 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
2894 | "Normalized property %s for peer `%s' changed to %.3f \n", | 3057 | "Normalized property %s for peer `%s' changed to %.3f \n", |
2895 | GNUNET_ATS_print_property_type (type), GNUNET_i2s (&address->peer), | 3058 | GNUNET_ATS_print_property_type (type), GNUNET_i2s (&address->peer), |
2896 | prop_rel); | 3059 | prop_rel); |
2897 | 3060 | ||
3061 | if (NULL != (p = find_peer_by_pid (&address->peer))) | ||
3062 | { | ||
3063 | for (pg = pref_gen_head; NULL != pg; pg = pg->next) | ||
3064 | { | ||
3065 | if (pg->peer == p->id) | ||
3066 | { | ||
3067 | duration = GNUNET_TIME_absolute_get_duration(pg->feedback_last_delay_update); | ||
3068 | delta = duration.rel_value_us * pg->last_delay_value; | ||
3069 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "------> DELTA %u %u\n",delta, duration.rel_value_us); | ||
3070 | pg->feedback_delay_acc += delta; | ||
3071 | |||
3072 | pg->last_delay_value = prop_rel; | ||
3073 | pg->feedback_last_bw_update = GNUNET_TIME_absolute_get(); | ||
3074 | } | ||
3075 | } | ||
3076 | |||
3077 | } | ||
3078 | |||
2898 | set_updated_property (address, type, prop_rel); | 3079 | set_updated_property (address, type, prop_rel); |
2899 | } | 3080 | } |
2900 | 3081 | ||
@@ -2958,6 +3139,7 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) | |||
2958 | GNUNET_asprintf (&sh->plugin, "libgnunet_plugin_ats_%s", solver_str); | 3139 | GNUNET_asprintf (&sh->plugin, "libgnunet_plugin_ats_%s", solver_str); |
2959 | 3140 | ||
2960 | sh->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | 3141 | sh->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
3142 | |||
2961 | /* setup environment */ | 3143 | /* setup environment */ |
2962 | sh->env.cfg = e->cfg; | 3144 | sh->env.cfg = e->cfg; |
2963 | sh->env.stats = GNUNET_STATISTICS_create ("ats", e->cfg); | 3145 | sh->env.stats = GNUNET_STATISTICS_create ("ats", e->cfg); |
diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h index 35f8fe7b3..27b9e4f9d 100644 --- a/src/ats/gnunet-ats-solver-eval.h +++ b/src/ats/gnunet-ats-solver-eval.h | |||
@@ -158,6 +158,9 @@ struct TestPeer | |||
158 | double pref_abs[GNUNET_ATS_PreferenceCount]; | 158 | double pref_abs[GNUNET_ATS_PreferenceCount]; |
159 | double pref_norm[GNUNET_ATS_PreferenceCount]; | 159 | double pref_norm[GNUNET_ATS_PreferenceCount]; |
160 | 160 | ||
161 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in; | ||
162 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out; | ||
163 | |||
161 | struct TestAddress *addr_head; | 164 | struct TestAddress *addr_head; |
162 | struct TestAddress *addr_tail; | 165 | struct TestAddress *addr_tail; |
163 | }; | 166 | }; |
@@ -208,6 +211,7 @@ struct GNUNET_ATS_TEST_Operation | |||
208 | long long unsigned int max_rate; | 211 | long long unsigned int max_rate; |
209 | struct GNUNET_TIME_Relative period; | 212 | struct GNUNET_TIME_Relative period; |
210 | struct GNUNET_TIME_Relative frequency; | 213 | struct GNUNET_TIME_Relative frequency; |
214 | struct GNUNET_TIME_Relative feedback_delay; | ||
211 | 215 | ||
212 | enum OperationType type; | 216 | enum OperationType type; |
213 | enum GeneratorType gen_type; | 217 | enum GeneratorType gen_type; |
@@ -276,10 +280,30 @@ struct PreferenceGenerator | |||
276 | long int max_value; | 280 | long int max_value; |
277 | struct GNUNET_TIME_Relative duration_period; | 281 | struct GNUNET_TIME_Relative duration_period; |
278 | struct GNUNET_TIME_Relative frequency; | 282 | struct GNUNET_TIME_Relative frequency; |
283 | struct GNUNET_TIME_Relative feedback_frequency; | ||
279 | 284 | ||
280 | GNUNET_SCHEDULER_TaskIdentifier set_task; | 285 | GNUNET_SCHEDULER_TaskIdentifier set_task; |
286 | GNUNET_SCHEDULER_TaskIdentifier feedback_task; | ||
281 | struct GNUNET_TIME_Absolute next_ping_transmission; | 287 | struct GNUNET_TIME_Absolute next_ping_transmission; |
282 | struct GNUNET_TIME_Absolute time_start; | 288 | struct GNUNET_TIME_Absolute time_start; |
289 | |||
290 | |||
291 | /* Feedback */ | ||
292 | uint32_t feedback_bw_out_acc; | ||
293 | uint32_t feedback_bw_in_acc; | ||
294 | uint32_t feedback_delay_acc; | ||
295 | |||
296 | double pref_bw_old; | ||
297 | double pref_latency_old; | ||
298 | |||
299 | struct GNUNET_TIME_Absolute feedback_last; | ||
300 | |||
301 | struct GNUNET_TIME_Absolute feedback_last_bw_update; | ||
302 | struct GNUNET_TIME_Absolute feedback_last_delay_update; | ||
303 | uint32_t last_assigned_bw_in; | ||
304 | uint32_t last_assigned_bw_out; | ||
305 | double last_delay_value; | ||
306 | |||
283 | }; | 307 | }; |
284 | 308 | ||
285 | 309 | ||