[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32159 - in gnunet/src/ats-tests: . experiments
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32159 - in gnunet/src/ats-tests: . experiments |
Date: |
Mon, 3 Feb 2014 13:36:25 +0100 |
Author: wachs
Date: 2014-02-03 13:36:25 +0100 (Mon, 03 Feb 2014)
New Revision: 32159
Modified:
gnunet/src/ats-tests/ats-testing-experiment.c
gnunet/src/ats-tests/ats-testing-log.c
gnunet/src/ats-tests/ats-testing-traffic.c
gnunet/src/ats-tests/ats-testing.c
gnunet/src/ats-tests/ats-testing.h
gnunet/src/ats-tests/experiments/send_linear_10_sec.exp
gnunet/src/ats-tests/gnunet-ats-sim.c
Log:
various fixes
Modified: gnunet/src/ats-tests/ats-testing-experiment.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-experiment.c 2014-02-03 09:58:18 UTC
(rev 32158)
+++ gnunet/src/ats-tests/ats-testing-experiment.c 2014-02-03 12:36:25 UTC
(rev 32159)
@@ -64,8 +64,8 @@
{
struct Episode *cur;
struct Episode *next;
- struct Operation *cur_o;
- struct Operation *next_o;
+ struct GNUNET_ATS_TEST_Operation *cur_o;
+ struct GNUNET_ATS_TEST_Operation *next_o;
next = e->start;
for (cur = next; NULL != cur; cur = next)
@@ -90,7 +90,7 @@
load_episode (struct Experiment *e, struct Episode *cur,
struct GNUNET_CONFIGURATION_Handle *cfg)
{
- struct Operation *o;
+ struct GNUNET_ATS_TEST_Operation *o;
char *sec_name;
char *op_name;
char *op;
@@ -106,9 +106,10 @@
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg,
sec_name, op_name, &op))
{
+ GNUNET_free (op_name);
break;
}
- o = GNUNET_new (struct Operation);
+ o = GNUNET_new (struct GNUNET_ATS_TEST_Operation);
/* operations = set_rate, start_send, stop_send, set_preference */
if (0 == strcmp (op, "start_send"))
{
@@ -179,14 +180,10 @@
GNUNET_free (op_name);
GNUNET_asprintf(&op_name, "op-%u-type", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg,
- sec_name, op_name, &type))
+ if ( (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_string(cfg,
+ sec_name, op_name, &type)) &&
+ (STOP_SEND != o->type))
{
- break;
- }
-
- if (STOP_SEND != o->type)
- {
/* Load arguments for set_rate, start_send, set_preference */
if (0 == strcmp (type, "constant"))
{
@@ -208,6 +205,7 @@
{
fprintf (stderr, "Invalid type %u `%s' in episode %u\n",
op_counter, op, cur->id);
+ GNUNET_free (type);
GNUNET_free (op);
GNUNET_free (op_name);
return GNUNET_SYSERR;
@@ -221,6 +219,7 @@
{
fprintf (stderr, "Missing base rate in operation %u `%s' in episode
%u\n",
op_counter, op, cur->id);
+ GNUNET_free (type);
GNUNET_free (op);
GNUNET_free (op_name);
return GNUNET_SYSERR;
@@ -238,22 +237,23 @@
{
fprintf (stderr, "Missing max rate in operation %u `%s' in episode
%u\n",
op_counter, op, cur->id);
+ GNUNET_free (type);
+ GNUNET_free (op_name);
GNUNET_free (op);
return GNUNET_SYSERR;
}
}
GNUNET_free (op_name);
+ /* Get period */
+ GNUNET_asprintf(&op_name, "op-%u-period", op_counter);
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
+ sec_name, op_name, &o->period))
{
- /* Get period */
- GNUNET_asprintf(&op_name, "op-%u-period", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
- sec_name, op_name, &o->period))
- {
- o->period = cur->duration;
- }
- GNUNET_free (op_name);
+ o->period = cur->duration;
}
+ GNUNET_free (op_name);
+
}
/* Safety checks */
@@ -270,9 +270,13 @@
fprintf (stderr, "Found operation %u in episode %u: %s [%llu]->[%llu] ==
%s, %llu -> %llu in %s\n",
op_counter, cur->id, print_op (o->type), o->src_id,
- o->dest_id, type, o->base_rate, o->max_rate,
+ o->dest_id, (NULL != type) ? type : "",
+ o->base_rate, o->max_rate,
GNUNET_STRINGS_relative_time_to_string (o->period, GNUNET_YES));
+ GNUNET_free_non_null (type);
+ GNUNET_free (op);
+
GNUNET_CONTAINER_DLL_insert (cur->head,cur->tail, o);
op_counter++;
}
@@ -351,32 +355,77 @@
}
static void
-enforce_start_send (struct Operation *op)
+enforce_start_send (struct GNUNET_ATS_TEST_Operation *op)
{
GNUNET_break (0);
}
static void
-enforce_stop_send (struct Operation *op)
+enforce_stop_send (struct GNUNET_ATS_TEST_Operation *op)
{
- GNUNET_break (0);
+ struct BenchmarkPartner *p;
+ p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
+ if (NULL == p)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id);
+
+ if (NULL != p->tg)
+ {
+ fprintf (stderr, "Stopping traffic between master %llu slave
%llu\n",op->src_id, op->dest_id);
+ GNUNET_ATS_TEST_generate_traffic_stop(p->tg);
+ p->tg = NULL;
+ }
+
+
}
static void
-enforce_set_rate (struct Operation *op)
+enforce_set_rate (struct GNUNET_ATS_TEST_Operation *op)
{
- GNUNET_break (0);
+ struct BenchmarkPeer *peer;
+ struct BenchmarkPartner *partner;
+
+ peer = GNUNET_ATS_TEST_get_peer (op->src_id);
+ if (NULL == peer)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
+ if (NULL == partner)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id);
+
+ if (NULL != partner->tg)
+ {
+ fprintf (stderr, "Stopping traffic between master %llu slave
%llu\n",op->src_id, op->dest_id);
+ GNUNET_ATS_TEST_generate_traffic_stop(partner->tg);
+ partner->tg = NULL;
+ }
+
+ partner->tg = GNUNET_ATS_TEST_generate_traffic_start(peer, partner,
+ op->tg_type, op->base_rate, op->max_rate, op->period,
+ GNUNET_TIME_UNIT_FOREVER_REL);
}
static void
-enforce_set_preference (struct Operation *op)
+enforce_set_preference (struct GNUNET_ATS_TEST_Operation *op)
{
GNUNET_break (0);
}
static void enforce_episode (struct Episode *ep)
{
- struct Operation *cur;
+ struct GNUNET_ATS_TEST_Operation *cur;
for (cur = ep->head; NULL != cur; cur = cur->next)
{
Modified: gnunet/src/ats-tests/ats-testing-log.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-log.c 2014-02-03 09:58:18 UTC (rev
32158)
+++ gnunet/src/ats-tests/ats-testing-log.c 2014-02-03 12:36:25 UTC (rev
32159)
@@ -757,7 +757,6 @@
GNUNET_SCHEDULER_cancel (l->log_task);
l->log_task = GNUNET_SCHEDULER_NO_TASK;
tc.reason = GNUNET_SCHEDULER_REASON_SHUTDOWN;
- collect_log_task (l, &tc);
l->running = GNUNET_NO;
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
Modified: gnunet/src/ats-tests/ats-testing-traffic.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-traffic.c 2014-02-03 09:58:18 UTC (rev
32158)
+++ gnunet/src/ats-tests/ats-testing-traffic.c 2014-02-03 12:36:25 UTC (rev
32159)
@@ -329,7 +329,7 @@
tg->time_start = GNUNET_TIME_absolute_get();
tg->next_ping_transmission = GNUNET_TIME_UNIT_FOREVER_ABS;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Setting up traffic generator master[%u] `%s' and slave [%u] `%s' max %u
Bips\n",
dest->me->no, GNUNET_i2s (&dest->me->id),
dest->dest->no, GNUNET_i2s (&dest->dest->id),
Modified: gnunet/src/ats-tests/ats-testing.c
===================================================================
--- gnunet/src/ats-tests/ats-testing.c 2014-02-03 09:58:18 UTC (rev 32158)
+++ gnunet/src/ats-tests/ats-testing.c 2014-02-03 12:36:25 UTC (rev 32159)
@@ -836,7 +836,24 @@
}
}
+struct BenchmarkPeer *
+GNUNET_ATS_TEST_get_peer (int src)
+{
+ if (src > top->num_masters)
+ return NULL;
+ return &top->mps[src];
+}
+struct BenchmarkPartner *
+GNUNET_ATS_TEST_get_partner (int src, int dest)
+{
+ if (src > top->num_masters)
+ return NULL;
+ if (dest > top->num_slaves)
+ return NULL;
+ return &top->mps[src].partners[dest];
+}
+
/**
* Create a topology for ats testing
*
@@ -898,6 +915,9 @@
if (NULL == top)
return;
+ GNUNET_free (top->mps);
+ GNUNET_free (top->sps);
+
GNUNET_SCHEDULER_shutdown();
}
Modified: gnunet/src/ats-tests/ats-testing.h
===================================================================
--- gnunet/src/ats-tests/ats-testing.h 2014-02-03 09:58:18 UTC (rev 32158)
+++ gnunet/src/ats-tests/ats-testing.h 2014-02-03 12:36:25 UTC (rev 32159)
@@ -456,10 +456,10 @@
/**
* An operation in an experiment
*/
-struct Operation
+struct GNUNET_ATS_TEST_Operation
{
- struct Operation *next;
- struct Operation *prev;
+ struct GNUNET_ATS_TEST_Operation *next;
+ struct GNUNET_ATS_TEST_Operation *prev;
long long unsigned int src_id;
long long unsigned int dest_id;
@@ -478,8 +478,8 @@
struct Episode *next;
struct GNUNET_TIME_Relative duration;
- struct Operation *head;
- struct Operation *tail;
+ struct GNUNET_ATS_TEST_Operation *head;
+ struct GNUNET_ATS_TEST_Operation *tail;
};
@@ -640,6 +640,12 @@
* Topology related functions
*/
+struct BenchmarkPeer *
+GNUNET_ATS_TEST_get_peer (int src);
+
+struct BenchmarkPartner *
+GNUNET_ATS_TEST_get_partner (int src, int dest);
+
/**
* Create a topology for ats testing
*
Modified: gnunet/src/ats-tests/experiments/send_linear_10_sec.exp
===================================================================
--- gnunet/src/ats-tests/experiments/send_linear_10_sec.exp 2014-02-03
09:58:18 UTC (rev 32158)
+++ gnunet/src/ats-tests/experiments/send_linear_10_sec.exp 2014-02-03
12:36:25 UTC (rev 32159)
@@ -2,23 +2,29 @@
name = test
masters = 1
slaves = 3
- max_duration = 10 s
+ max_duration = 2 s
cfg_file = gnunet_ats_sim_default.conf
[episode-0]
# operations = set_rate, start_send, stop_send, set_preference
-duration = 10 s
+duration = 2 s
op-0-operation = set_rate
-op-0-value = 10000
op-0-src = 0
-op-0-dest = 1
+op-0-dest = 0
+op-0-type = constant
+op-0-base-rate= 10000
+op-0-max-rate = 10000
op-1-operation = set_rate
-op-1-value = 10000
op-1-src = 0
-op-1-dest = 2
+op-1-dest = 1
+op-1-type = constant
+op-1-base-rate= 10000
+op-1-max-rate = 10000
op-2-operation = set_rate
-op-2-value = 10000
op-2-src = 0
-op-2-dest = 3
\ No newline at end of file
+op-2-dest = 2
+op-2-type = constant
+op-2-base-rate= 10000
+op-2-max-rate = 10000
\ No newline at end of file
Modified: gnunet/src/ats-tests/gnunet-ats-sim.c
===================================================================
--- gnunet/src/ats-tests/gnunet-ats-sim.c 2014-02-03 09:58:18 UTC (rev
32158)
+++ gnunet/src/ats-tests/gnunet-ats-sim.c 2014-02-03 12:36:25 UTC (rev
32159)
@@ -123,12 +123,21 @@
static void
do_shutdown ()
{
+ fprintf (stderr, "Shutdown\n");
/* timeout */
+ if (NULL != l)
+ {
+ GNUNET_ATS_TEST_logging_stop (l);
+ GNUNET_ATS_TEST_logging_clean_up (l);
+ l = NULL;
+ }
if (NULL != e)
{
+ GNUNET_break (0);
GNUNET_ATS_TEST_experimentation_stop (e);
e = NULL;
}
+ GNUNET_break (0);
GNUNET_ATS_TEST_shutdown_topology ();
}
@@ -237,6 +246,7 @@
*/
/* Example: Generate traffic with a sinus form, a base rate of
* 1000 Bytes/s, an amplitude of (max-base), and a period of 1 minute
*/
+ /*
GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m],
&masters[c_m].partners[c_s],
GNUNET_ATS_TEST_TG_SINUS,
@@ -244,6 +254,7 @@
2000,
GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_FOREVER_REL);
+ */
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32159 - in gnunet/src/ats-tests: . experiments,
gnunet <=