diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-05-29 13:56:29 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-05-29 13:56:29 +0000 |
commit | 01eb60d5f389fc933174298c55f771cdbee010aa (patch) | |
tree | 272b3e0a66758b92f2a01b2c8bdb374516dd94d3 | |
parent | 0f821828934dfa4959c75f8ca06be651fd535001 (diff) | |
download | gnunet-01eb60d5f389fc933174298c55f771cdbee010aa.tar.gz gnunet-01eb60d5f389fc933174298c55f771cdbee010aa.zip |
changes
-rw-r--r-- | src/experimentation/Makefile.am | 10 | ||||
-rw-r--r-- | src/experimentation/gnunet-daemon-experimentation.h | 5 | ||||
-rw-r--r-- | src/experimentation/gnunet-daemon-experimentation_nodes.c | 12 | ||||
-rw-r--r-- | src/experimentation/gnunet-daemon-experimentation_scheduler.c | 32 |
4 files changed, 44 insertions, 15 deletions
diff --git a/src/experimentation/Makefile.am b/src/experimentation/Makefile.am index 49876adc1..02fe9cc1f 100644 --- a/src/experimentation/Makefile.am +++ b/src/experimentation/Makefile.am | |||
@@ -18,7 +18,7 @@ endif | |||
18 | 18 | ||
19 | 19 | ||
20 | if HAVE_EXPERIMENTAL | 20 | if HAVE_EXPERIMENTAL |
21 | TEXT_EXP_CLIQUE = test_experimentation_clique_connect | 21 | TEXT_EXP_CLIQUE = test_experimentation_clique_connect test_experimentation_clique_run |
22 | endif | 22 | endif |
23 | 23 | ||
24 | check_PROGRAMS = \ | 24 | check_PROGRAMS = \ |
@@ -51,6 +51,14 @@ test_experimentation_clique_connect_LDADD = \ | |||
51 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 51 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
52 | $(top_builddir)/src/testbed/libgnunettestbed.la | 52 | $(top_builddir)/src/testbed/libgnunettestbed.la |
53 | 53 | ||
54 | test_experimentation_clique_run_SOURCES = \ | ||
55 | test_experimentation_clique_run.c | ||
56 | test_experimentation_clique_run_LDADD = \ | ||
57 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
58 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | ||
59 | $(top_builddir)/src/testbed/libgnunettestbed.la | ||
60 | |||
61 | |||
54 | EXTRA_DIST = \ | 62 | EXTRA_DIST = \ |
55 | test_experimentation_clique.conf \ | 63 | test_experimentation_clique.conf \ |
56 | test_experiments.exp \ No newline at end of file | 64 | test_experiments.exp \ No newline at end of file |
diff --git a/src/experimentation/gnunet-daemon-experimentation.h b/src/experimentation/gnunet-daemon-experimentation.h index 2d19720d0..999c565ad 100644 --- a/src/experimentation/gnunet-daemon-experimentation.h +++ b/src/experimentation/gnunet-daemon-experimentation.h | |||
@@ -34,7 +34,7 @@ | |||
34 | /** | 34 | /** |
35 | * Timeout between request and expected response | 35 | * Timeout between request and expected response |
36 | */ | 36 | */ |
37 | #define EXP_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | 37 | #define EXP_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Default experiment frequency | 40 | * Default experiment frequency |
@@ -205,6 +205,9 @@ struct Experimentation_Response | |||
205 | uint32_t issuer_count; | 205 | uint32_t issuer_count; |
206 | }; | 206 | }; |
207 | 207 | ||
208 | void | ||
209 | GNUNET_EXPERIMENT_nodes_request_start (struct Node *n, struct Experiment *e); | ||
210 | |||
208 | 211 | ||
209 | /** | 212 | /** |
210 | * Start the nodes management | 213 | * Start the nodes management |
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c index 8631e5d58..ac1d00ce0 100644 --- a/src/experimentation/gnunet-daemon-experimentation_nodes.c +++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c | |||
@@ -304,7 +304,6 @@ static void | |||
304 | get_experiments_cb (struct Node *n, struct Experiment *e) | 304 | get_experiments_cb (struct Node *n, struct Experiment *e) |
305 | { | 305 | { |
306 | static int counter = 0; | 306 | static int counter = 0; |
307 | //size_t start_size; | ||
308 | if (NULL == e) | 307 | if (NULL == e) |
309 | { | 308 | { |
310 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Added %u experiments for peer %s\n"), | 309 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Added %u experiments for peer %s\n"), |
@@ -317,10 +316,6 @@ get_experiments_cb (struct Node *n, struct Experiment *e) | |||
317 | GNUNET_i2s (&n->id)); | 316 | GNUNET_i2s (&n->id)); |
318 | 317 | ||
319 | /* Request experiment */ | 318 | /* Request experiment */ |
320 | /* start_size = sizeof (struct Experimentation_Start); | ||
321 | GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, EXP_RESPONSE_TIMEOUT, | ||
322 | n->id, start_size, send_start_cb, n);*/ | ||
323 | |||
324 | GNUNET_EXPERIMENTATION_scheduler_add (n, e); | 319 | GNUNET_EXPERIMENTATION_scheduler_add (n, e); |
325 | 320 | ||
326 | counter ++; | 321 | counter ++; |
@@ -633,6 +628,13 @@ core_receive_handler (void *cls, | |||
633 | } | 628 | } |
634 | 629 | ||
635 | 630 | ||
631 | void | ||
632 | GNUNET_EXPERIMENT_nodes_request_start (struct Node *n, struct Experiment *e) | ||
633 | { | ||
634 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Sending start request to peer `%s' for experiment `%s'\n"), | ||
635 | GNUNET_i2s(&n->id), e->name); | ||
636 | } | ||
637 | |||
636 | 638 | ||
637 | /** | 639 | /** |
638 | * Start the nodes management | 640 | * Start the nodes management |
diff --git a/src/experimentation/gnunet-daemon-experimentation_scheduler.c b/src/experimentation/gnunet-daemon-experimentation_scheduler.c index 37f4f0640..502c65229 100644 --- a/src/experimentation/gnunet-daemon-experimentation_scheduler.c +++ b/src/experimentation/gnunet-daemon-experimentation_scheduler.c | |||
@@ -52,6 +52,8 @@ struct ScheduledExperiment { | |||
52 | struct ScheduledExperiment *list_head; | 52 | struct ScheduledExperiment *list_head; |
53 | struct ScheduledExperiment *list_tail; | 53 | struct ScheduledExperiment *list_tail; |
54 | 54 | ||
55 | static unsigned int experiments_scheduled; | ||
56 | static unsigned int experiments_requested; | ||
55 | 57 | ||
56 | static void | 58 | static void |
57 | request_timeout (void *cls,const struct GNUNET_SCHEDULER_TaskContext* tc) | 59 | request_timeout (void *cls,const struct GNUNET_SCHEDULER_TaskContext* tc) |
@@ -66,6 +68,10 @@ request_timeout (void *cls,const struct GNUNET_SCHEDULER_TaskContext* tc) | |||
66 | GNUNET_free (se); | 68 | GNUNET_free (se); |
67 | 69 | ||
68 | /* Remove experiment */ | 70 | /* Remove experiment */ |
71 | |||
72 | GNUNET_assert (experiments_requested > 0); | ||
73 | experiments_requested --; | ||
74 | GNUNET_STATISTICS_set (GSE_stats, "# experiments requested", experiments_requested, GNUNET_NO); | ||
69 | } | 75 | } |
70 | 76 | ||
71 | static void run (void *cls,const struct GNUNET_SCHEDULER_TaskContext* tc) | 77 | static void run (void *cls,const struct GNUNET_SCHEDULER_TaskContext* tc) |
@@ -74,15 +80,18 @@ static void run (void *cls,const struct GNUNET_SCHEDULER_TaskContext* tc) | |||
74 | struct GNUNET_TIME_Relative end; | 80 | struct GNUNET_TIME_Relative end; |
75 | se->task = GNUNET_SCHEDULER_NO_TASK; | 81 | se->task = GNUNET_SCHEDULER_NO_TASK; |
76 | 82 | ||
77 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Executing `%s'\n", se->e->name); | ||
78 | |||
79 | 83 | ||
80 | if (NOT_RUNNING == se->state) | 84 | if (NOT_RUNNING == se->state) |
81 | { | 85 | { |
82 | /* Send start message */ | 86 | /* Send start message */ |
83 | //GNUNET_EXPERIMENT_nodes_request_start (se->e); | 87 | GNUNET_EXPERIMENT_nodes_request_start (se->n, se->e); |
84 | se->state = REQUESTED; | 88 | se->state = REQUESTED; |
85 | se->task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &request_timeout, se); | 89 | se->task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &request_timeout, se); |
90 | |||
91 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Sending start request to peer `%s' for `%s'\n", | ||
92 | GNUNET_i2s (&se->n->id), se->e->name); | ||
93 | experiments_requested ++; | ||
94 | GNUNET_STATISTICS_set (GSE_stats, "# experiments requested", experiments_requested, GNUNET_NO); | ||
86 | return; | 95 | return; |
87 | } | 96 | } |
88 | else if (REQUESTED == se->state) | 97 | else if (REQUESTED == se->state) |
@@ -93,6 +102,8 @@ static void run (void *cls,const struct GNUNET_SCHEDULER_TaskContext* tc) | |||
93 | else if (STARTED == se->state) | 102 | else if (STARTED == se->state) |
94 | { | 103 | { |
95 | /* Experiment is running */ | 104 | /* Experiment is running */ |
105 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Running experiment `%s' peer for `%s'\n", | ||
106 | GNUNET_i2s (&se->n->id), se->e->name); | ||
96 | 107 | ||
97 | /* do work here */ | 108 | /* do work here */ |
98 | 109 | ||
@@ -124,12 +135,11 @@ GNUNET_EXPERIMENTATION_scheduler_add (struct Node *n, struct Experiment *e) | |||
124 | 135 | ||
125 | start = GNUNET_TIME_absolute_get_remaining(e->start); | 136 | start = GNUNET_TIME_absolute_get_remaining(e->start); |
126 | end = GNUNET_TIME_absolute_get_remaining(e->stop); | 137 | end = GNUNET_TIME_absolute_get_remaining(e->stop); |
127 | |||
128 | /* Add additional checks here if required */ | ||
129 | |||
130 | if (0 == end.rel_value) | 138 | if (0 == end.rel_value) |
131 | return; /* End of experiment is reached */ | 139 | return; /* End of experiment is reached */ |
132 | 140 | ||
141 | /* Add additional checks here if required */ | ||
142 | |||
133 | se = GNUNET_malloc (sizeof (struct ScheduledExperiment)); | 143 | se = GNUNET_malloc (sizeof (struct ScheduledExperiment)); |
134 | se->state = NOT_RUNNING; | 144 | se->state = NOT_RUNNING; |
135 | se->e = e; | 145 | se->e = e; |
@@ -140,8 +150,10 @@ GNUNET_EXPERIMENTATION_scheduler_add (struct Node *n, struct Experiment *e) | |||
140 | se->task = GNUNET_SCHEDULER_add_delayed (start, &run, se); | 150 | se->task = GNUNET_SCHEDULER_add_delayed (start, &run, se); |
141 | 151 | ||
142 | GNUNET_CONTAINER_DLL_insert (list_head, list_tail, se); | 152 | GNUNET_CONTAINER_DLL_insert (list_head, list_tail, se); |
143 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Added experiment `%s' for node to be scheduled\n", | 153 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Added experiment `%s' for node to be scheduled\n", |
144 | e->name, GNUNET_i2s(&se->n->id)); | 154 | e->name, GNUNET_i2s(&se->n->id)); |
155 | experiments_scheduled ++; | ||
156 | GNUNET_STATISTICS_set (GSE_stats, "# experiments scheduled", experiments_scheduled, GNUNET_NO); | ||
145 | } | 157 | } |
146 | 158 | ||
147 | /** | 159 | /** |
@@ -150,7 +162,8 @@ GNUNET_EXPERIMENTATION_scheduler_add (struct Node *n, struct Experiment *e) | |||
150 | void | 162 | void |
151 | GNUNET_EXPERIMENTATION_scheduler_start () | 163 | GNUNET_EXPERIMENTATION_scheduler_start () |
152 | { | 164 | { |
153 | 165 | experiments_requested = 0; | |
166 | experiments_scheduled = 0; | ||
154 | } | 167 | } |
155 | 168 | ||
156 | 169 | ||
@@ -174,6 +187,9 @@ GNUNET_EXPERIMENTATION_scheduler_stop () | |||
174 | cur->task = GNUNET_SCHEDULER_NO_TASK; | 187 | cur->task = GNUNET_SCHEDULER_NO_TASK; |
175 | } | 188 | } |
176 | GNUNET_free (cur); | 189 | GNUNET_free (cur); |
190 | GNUNET_assert (experiments_scheduled > 0); | ||
191 | experiments_scheduled --; | ||
192 | GNUNET_STATISTICS_set (GSE_stats, "# experiments scheduled", experiments_scheduled, GNUNET_NO); | ||
177 | } | 193 | } |
178 | } | 194 | } |
179 | 195 | ||