[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32292 - in gnunet/src/ats: . experiments
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32292 - in gnunet/src/ats: . experiments |
Date: |
Tue, 11 Feb 2014 09:55:04 +0100 |
Author: wachs
Date: 2014-02-11 09:55:04 +0100 (Tue, 11 Feb 2014)
New Revision: 32292
Modified:
gnunet/src/ats/experiments/example.exp
gnunet/src/ats/gnunet-ats-solver-eval.c
gnunet/src/ats/gnunet-ats-solver-eval.h
Log:
improved episode parsing
added request support
Modified: gnunet/src/ats/experiments/example.exp
===================================================================
--- gnunet/src/ats/experiments/example.exp 2014-02-11 08:33:19 UTC (rev
32291)
+++ gnunet/src/ats/experiments/example.exp 2014-02-11 08:55:04 UTC (rev
32292)
@@ -7,7 +7,8 @@
cfg_file = gnunet_ats_sim_default.conf
[episode-0]
-# operations = address_add, address_del, start_set_property,
stop_set_property, start_set_preference, stop_preference
+# operations = address_add, address_del, start_set_property,
stop_set_property,
+# start_set_preference, stop_preference, start_request, stop_request
duration = 2 s
op-0-operation = address_add
op-0-address-id = 0
@@ -17,29 +18,32 @@
op-0-address = 0_0_udp
op-0-plugin = udp
-op-1-operation = start_set_preference
-op-1-address-id = 1
-op-1-peer-id = 1
+#op-1-operation = start_set_preference
+#op-1-address-id = 1
+#op-1-peer-id = 1
# constant, linear, sinus, random
-op-1-gen-type = constant
-op-1-base-rate= 10000
-op-1-max-rate = 100000
-op-1-frequency = 500 ms
+#op-1-gen-type = constant
+#op-1-base-rate= 10000
+#op-1-max-rate = 100000
+#op-1-frequency = 500 ms
# BANDWIDTH, LATENCY
-op-1-pref = BANDWIDTH
+#op-1-pref = BANDWIDTH
-#op-2-operation = start_set_property
-#op-2-address-id = 0
-#op-2-peer-id = 0
+op-1-operation = start_set_property
+op-1-address-id = 0
+op-1-peer-id = 0
# constant, linear, sinus, random
-#op-2-gen-type = linear
-#op-2-base-rate= 10000
-#op-2-max-rate = 10000
-#op-2-frequency = 100 ms
+op-1-gen-type = random
+op-1-base-rate= 10000
+op-1-max-rate = 100000
+op-1-frequency = 100 ms
# bandwidth, latency
# "TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN",
"UTILIZATION_PAYLOAD_UP", "UTILIZATION_PAYLOAD_DOWN", "NETWORK_TYPE", "DELAY",
"DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN"
-#op-2-property = UTILIZATION_UP
+op-1-property = UTILIZATION_UP
+op-2-operation = start_request
+op-2-peer-id = 0
+
[episode-1]
duration = 2 s
@@ -59,4 +63,7 @@
op-2-operation = stop_set_property
op-2-address-id = 0
op-2-peer-id = 0
-op-2-property = UTILIZATION_UP
\ No newline at end of file
+op-2-property = UTILIZATION_UP
+
+op-3-operation = stop_request
+op-3-peer-id = 0
\ No newline at end of file
Modified: gnunet/src/ats/gnunet-ats-solver-eval.c
===================================================================
--- gnunet/src/ats/gnunet-ats-solver-eval.c 2014-02-11 08:33:19 UTC (rev
32291)
+++ gnunet/src/ats/gnunet-ats-solver-eval.c 2014-02-11 08:55:04 UTC (rev
32292)
@@ -613,9 +613,13 @@
case SOLVER_OP_STOP_SET_PREFERENCE:
return "STOP_STOP_PREFERENCE";
case SOLVER_OP_START_SET_PROPERTY:
- return "START_SET_PROPERTY";
+ return "START_SET_PROPERTY";
case SOLVER_OP_STOP_SET_PROPERTY:
return "STOP_SET_PROPERTY";
+ case SOLVER_OP_START_REQUEST:
+ return "START_REQUEST";
+ case SOLVER_OP_STOP_REQUEST:
+ return "STOP_REQUEST";
default:
break;
}
@@ -1134,22 +1138,18 @@
if (0 == strcmp (type, "constant"))
{
o->gen_type = GNUNET_ATS_TEST_TG_CONSTANT;
- GNUNET_break (0);
}
else if (0 == strcmp (type, "linear"))
{
o->gen_type = GNUNET_ATS_TEST_TG_LINEAR;
- GNUNET_break (0);
}
else if (0 == strcmp (type, "sinus"))
{
o->gen_type = GNUNET_ATS_TEST_TG_SINUS;
- GNUNET_break (0);
}
else if (0 == strcmp (type, "random"))
{
o->gen_type = GNUNET_ATS_TEST_TG_RANDOM;
- GNUNET_break (0);
}
else
{
@@ -1313,7 +1313,55 @@
return GNUNET_OK;
}
+
static int
+load_op_start_request (struct GNUNET_ATS_TEST_Operation *o,
+ struct Episode *e,
+ int op_counter,
+ char *sec_name,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+ char *op_name;
+
+ /* peer id */
+ GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
+ sec_name, op_name, &o->peer_id))
+ {
+ fprintf (stderr, "Missing peer-id in operation %u `%s' in episode `%s'\n",
+ op_counter, "START_REQUEST", op_name);
+ GNUNET_free (op_name);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (op_name);
+ return GNUNET_OK;
+}
+
+static int
+load_op_stop_request (struct GNUNET_ATS_TEST_Operation *o,
+ struct Episode *e,
+ int op_counter,
+ char *sec_name,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+ char *op_name;
+
+ /* peer id */
+ GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
+ sec_name, op_name, &o->peer_id))
+ {
+ fprintf (stderr, "Missing peer-id in operation %u `%s' in episode `%s'\n",
+ op_counter, "STOP_REQUEST", op_name);
+ GNUNET_free (op_name);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (op_name);
+ return GNUNET_OK;
+}
+
+
+static int
load_episode (struct Experiment *e, struct Episode *cur,
struct GNUNET_CONFIGURATION_Handle *cfg)
{
@@ -1322,6 +1370,7 @@
char *op_name;
char *op;
int op_counter = 0;
+ int res;
fprintf (stderr, "Parsing episode %u\n",cur->id);
GNUNET_asprintf(&sec_name, "episode-%u", cur->id);
@@ -1340,93 +1389,68 @@
if (0 == strcmp (op, "address_add"))
{
o->type = SOLVER_OP_ADD_ADDRESS;
- if (GNUNET_SYSERR == load_op_add_address (o, cur,
- op_counter, sec_name, cfg))
- {
- GNUNET_free (o);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
+ res = load_op_add_address (o, cur,
+ op_counter, sec_name, cfg);
}
else if (0 == strcmp (op, "address_del"))
{
o->type = SOLVER_OP_DEL_ADDRESS;
- if (GNUNET_SYSERR == load_op_del_address (o, cur,
- op_counter, sec_name, cfg))
- {
- GNUNET_free (o);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
+ res = load_op_del_address (o, cur,
+ op_counter, sec_name, cfg);
}
else if (0 == strcmp (op, "start_set_property"))
{
o->type = SOLVER_OP_START_SET_PROPERTY;
- if (GNUNET_SYSERR == load_op_start_set_property (o, cur,
- op_counter, sec_name, cfg))
- {
- GNUNET_free (o);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
+ res = load_op_start_set_property (o, cur,
+ op_counter, sec_name, cfg);
}
else if (0 == strcmp (op, "stop_set_property"))
{
o->type = SOLVER_OP_STOP_SET_PROPERTY;
- if (GNUNET_SYSERR == load_op_stop_set_property (o, cur,
- op_counter, sec_name, cfg))
- {
- GNUNET_free (o);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
+ res = load_op_stop_set_property (o, cur,
+ op_counter, sec_name, cfg);
}
else if (0 == strcmp (op, "start_set_preference"))
{
o->type = SOLVER_OP_START_SET_PREFERENCE;
- if (GNUNET_SYSERR == load_op_start_set_preference (o, cur,
- op_counter, sec_name, cfg))
- {
- GNUNET_free (o);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
+ res = load_op_start_set_preference (o, cur,
+ op_counter, sec_name, cfg);
+ break;
}
else if (0 == strcmp (op, "stop_set_preference"))
{
o->type = SOLVER_OP_STOP_SET_PREFERENCE;
- if (GNUNET_SYSERR == load_op_stop_set_preference (o, cur,
- op_counter, sec_name, cfg))
- {
- GNUNET_free (o);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
+ res = load_op_stop_set_preference (o, cur,
+ op_counter, sec_name, cfg);
}
+ else if (0 == strcmp (op, "start_request"))
+ {
+ o->type = SOLVER_OP_START_REQUEST;
+ res = load_op_start_request (o, cur,
+ op_counter, sec_name, cfg);
+ }
+ else if (0 == strcmp (op, "stop_request"))
+ {
+ o->type = SOLVER_OP_STOP_REQUEST;
+ res = load_op_stop_request(o, cur,
+ op_counter, sec_name, cfg);
+ }
else
{
fprintf (stderr, "Invalid operation %u `%s' in episode %u\n",
op_counter, op, cur->id);
+ res = GNUNET_SYSERR;
+ }
+
+ GNUNET_free (op);
+ GNUNET_free (op_name);
+
+ if (GNUNET_SYSERR == res)
+ {
GNUNET_free (o);
- GNUNET_free (op);
- GNUNET_free (op_name);
GNUNET_free (sec_name);
return GNUNET_SYSERR;
}
- GNUNET_free (op);
- GNUNET_free (op_name);
GNUNET_CONTAINER_DLL_insert (cur->head,cur->tail, o);
op_counter++;
@@ -1818,6 +1842,21 @@
GNUNET_ATS_solver_generate_preferences_stop (pg);
}
+
+static void
+enforce_start_request (struct GNUNET_ATS_TEST_Operation *op)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requesting address for peer %u\n",
+ op->peer_id);
+}
+
+static void
+enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stop requesting address for peer %u\n",
+ op->peer_id);
+}
+
static void enforce_episode (struct Episode *ep)
{
struct GNUNET_ATS_TEST_Operation *cur;
@@ -1854,6 +1893,16 @@
print_op (cur->type), cur->peer_id, cur->address_id,
cur->base_rate);
enforce_stop_preference (cur);
break;
+ case SOLVER_OP_START_REQUEST:
+ fprintf (stderr, "Enforcing operation: %s [%llu]\n",
+ print_op (cur->type), cur->peer_id);
+ enforce_start_request (cur);
+ break;
+ case SOLVER_OP_STOP_REQUEST:
+ fprintf (stderr, "Enforcing operation: %s [%llu]\n",
+ print_op (cur->type), cur->peer_id);
+ enforce_stop_request (cur);
+ break;
default:
break;
}
@@ -2056,11 +2105,6 @@
}
/**
- * Logging
- */
-
-
-/**
* Solver
*/
Modified: gnunet/src/ats/gnunet-ats-solver-eval.h
===================================================================
--- gnunet/src/ats/gnunet-ats-solver-eval.h 2014-02-11 08:33:19 UTC (rev
32291)
+++ gnunet/src/ats/gnunet-ats-solver-eval.h 2014-02-11 08:55:04 UTC (rev
32292)
@@ -47,7 +47,9 @@
SOLVER_OP_START_SET_PROPERTY,
SOLVER_OP_STOP_SET_PROPERTY,
SOLVER_OP_START_SET_PREFERENCE,
- SOLVER_OP_STOP_SET_PREFERENCE
+ SOLVER_OP_STOP_SET_PREFERENCE,
+ SOLVER_OP_START_REQUEST,
+ SOLVER_OP_STOP_REQUEST,
};
struct Episode;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32292 - in gnunet/src/ats: . experiments,
gnunet <=