[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14756 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14756 - gnunet/src/transport |
Date: |
Mon, 28 Mar 2011 17:46:25 +0200 |
Author: wachs
Date: 2011-03-28 17:46:25 +0200 (Mon, 28 Mar 2011)
New Revision: 14756
Modified:
gnunet/src/transport/Makefile.am
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/test_transport_ats.c
gnunet/src/transport/test_transport_ats_peer1.conf
gnunet/src/transport/transport.h
Log:
ats
Modified: gnunet/src/transport/Makefile.am
===================================================================
--- gnunet/src/transport/Makefile.am 2011-03-28 15:05:21 UTC (rev 14755)
+++ gnunet/src/transport/Makefile.am 2011-03-28 15:46:25 UTC (rev 14756)
@@ -270,6 +270,7 @@
test_transport_ats_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/hello/libgnunethello.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la
test_transport_api_tcp_SOURCES = \
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2011-03-28 15:05:21 UTC
(rev 14755)
+++ gnunet/src/transport/gnunet-service-transport.c 2011-03-28 15:46:25 UTC
(rev 14756)
@@ -48,8 +48,8 @@
#define DEBUG_TRANSPORT_HELLO GNUNET_YES
-#define DEBUG_ATS GNUNET_YES
-#define VERBOSE_ATS GNUNET_YES
+#define DEBUG_ATS GNUNET_NO
+#define VERBOSE_ATS GNUNET_NO
/**
* Should we do some additional checks (to validate behavior
@@ -5580,7 +5580,6 @@
int rows = 1 + (3*peers) + (transports);
int cols = peers;
int index = 1;
- //int start = 0;
int cur_row = 0;
int size = 1+(rows*cols);
@@ -5592,7 +5591,7 @@
double value;
if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Creating LP
problem: %i peers, relativity r %3.2f, b_max %5.2f, b_min %5.2f, \n",peers, r,
b_max, b_min);
- if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Current memory
consumption %i\n",(1+(rows*cols) * (2*sizeof(int) + sizeof(double))) /
(1024*1024));
+ if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Current memory
consumption %i\n",(1+(rows*cols) * (2*sizeof(int) + sizeof(double))));
lp = glp_create_prob();
glp_set_prob_name(lp, "gnunet ats bandwidth distribution");
glp_set_obj_dir(lp, GLP_MAX);
@@ -5704,7 +5703,6 @@
if (pl[c2-1].t == tl[c1].id)
value = tl[c1].c_1;
else value = 0;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Transport %i peer
%i: index %i size %i value %f\n", c1,c2, index, size, value);
ar[index] = value;
index++;
}
@@ -5836,6 +5834,7 @@
void ats_benchmark (int peers, int transports, int start_peers, int end_peers)
{
struct GNUNET_TIME_Absolute start;
+ struct GNUNET_TIME_Relative duration;
int test = 11;
int mlp = GNUNET_NO;
@@ -5875,7 +5874,7 @@
tl[c].id = c;
tl[c].c_max = 10000;
tl[c].c_1 = 1;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"ats_calculate_bandwidth_distribution Peer[%i] : %i \n",c , tl[c].id);
+ //GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"ats_calculate_bandwidth_distribution Peer[%i] : %i \n",c , tl[c].id);
c++;
}
@@ -5888,9 +5887,14 @@
// test //
start = GNUNET_TIME_absolute_get();
ats_create_problem(peers, transports, b_min, b_max, r, R, pl, tl, it,
dur, mlp);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "benchmark result
({LP/MLP},peers,duration,mem):%s,%i,%llu,%i\n",(mlp)?"mlp":"lp", peers,
-
GNUNET_TIME_absolute_get_difference(start,GNUNET_TIME_absolute_get()).rel_value,
(1+(peers*transports) * (2*sizeof(int) + sizeof(double))));
+ duration =
GNUNET_TIME_absolute_get_difference(start,GNUNET_TIME_absolute_get());
+
+ if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "benchmark result
({LP/MLP},peers,duration,mem):%s,%i,%llu,%i\n",
+ (mlp)?"mlp":"lp", (int )peers,
duration.rel_value,
+ (1+(peers*transports) * (2*sizeof(int) +
sizeof(double))));
+
+ GNUNET_STATISTICS_set (stats, "ATS execution time 100 peers",
duration.rel_value, GNUNET_NO);
GNUNET_free (pl);
GNUNET_free (tl);
}
@@ -5902,7 +5906,7 @@
if (delta.rel_value < ats->min_delta.rel_value)
{
#if DEBUG_ATS
- //GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Minimum time between
cycles not reached\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Minimum time between
cycles not reached\n");
#endif
return;
}
@@ -5930,7 +5934,7 @@
struct ATS_peer * pl = NULL;
start = GNUNET_TIME_absolute_get();
- ats_benchmark(10,3,10,10);
+ ats_benchmark(100,3,100,100);
//ats_create_problem(peers, transports, b_min, b_max, r, R, pl, tl, it,
dur, mlp);
GNUNET_free_non_null (pl);
@@ -6159,11 +6163,6 @@
validation_map = NULL;
return;
}
-#if HAVE_GLPK
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("HAVE\n"));
-#else
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("NOT HAVE\n"));
-#endif
ats = ats_init();
max_connect_per_transport = (uint32_t) tneigh;
Modified: gnunet/src/transport/test_transport_ats.c
===================================================================
--- gnunet/src/transport/test_transport_ats.c 2011-03-28 15:05:21 UTC (rev
14755)
+++ gnunet/src/transport/test_transport_ats.c 2011-03-28 15:46:25 UTC (rev
14756)
@@ -34,7 +34,9 @@
#include "gnunet_program_lib.h"
#include "gnunet_scheduler_lib.h"
#include "gnunet_transport_service.h"
+#include "gnunet_statistics_service.h"
#include "transport.h"
+#include "gauger.h"
#define VERBOSE GNUNET_NO
@@ -45,7 +47,7 @@
/**
* How long until we give up on transmitting the message?
*/
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
/**
* How long until we give up on transmitting the message?
@@ -59,6 +61,7 @@
struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_TRANSPORT_Handle *th;
struct GNUNET_PeerIdentity id;
+ struct GNUNET_STATISTICS_Handle *stats;
#if START_ARM
struct GNUNET_OS_Process *arm_proc;
#endif
@@ -66,6 +69,12 @@
static struct PeerContext p1;
+/**
+ * Handle for reporting statistics.
+ */
+
+
+
static struct PeerContext p2;
static int ok;
@@ -90,12 +99,7 @@
static GNUNET_SCHEDULER_TaskIdentifier die_task;
-static char * key_file_p1;
-static char * cert_file_p1;
-static char * key_file_p2;
-static char * cert_file_p2;
-
#if VERBOSE
#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok,
__FILE__, __LINE__); } while (0)
#else
@@ -112,7 +116,8 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n");
GNUNET_TRANSPORT_disconnect (p1.th);
GNUNET_TRANSPORT_disconnect (p2.th);
-
+ if (p1.stats != NULL)
+ GNUNET_STATISTICS_destroy (p1.stats, GNUNET_NO);
die_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transports disconnected, returning
success!\n");
ok = 0;
@@ -138,6 +143,8 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n");
//GNUNET_break (0);
GNUNET_TRANSPORT_disconnect (p1.th);
+ if (p1.stats != NULL)
+ GNUNET_STATISTICS_destroy (p1.stats, GNUNET_NO);
//GNUNET_TRANSPORT_disconnect (p2.th);
ok = 1;
}
@@ -203,9 +210,6 @@
{
if (cls == &p1)
{
- GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT_TRANSMIT,
- &end_badly, NULL);
GNUNET_TRANSPORT_notify_transmit_ready (p1.th,
&p2.id,
@@ -225,7 +229,18 @@
GNUNET_i2s (peer), cls);
}
+int stat_cb (void *cls,
+ const char *subsystem,
+ const char *name,
+ uint64_t value,
+ int is_persistent)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Execution time for 100 Peers: %llu\n",value);
+ return GNUNET_NO;
+}
+
static void
setup_peer (struct PeerContext *p, const char *cfgname)
{
@@ -239,69 +254,19 @@
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
+ p->stats = GNUNET_STATISTICS_create ("transport", p->cfg);
+ GNUNET_assert (p->stats != NULL);
+ GNUNET_assert (GNUNET_OK == GNUNET_STATISTICS_watch
(p->stats,"transport","ATS execution time 100 peers", stat_cb, NULL));
- if (is_https)
- {
- struct stat sbuf;
- if (p==&p1)
- {
- if (GNUNET_CONFIGURATION_have_value (p->cfg,
-
"transport-https", "KEY_FILE"))
- GNUNET_CONFIGURATION_get_value_string (p->cfg,
"transport-https", "KEY_FILE", &key_file_p1);
- if (key_file_p1==NULL)
- GNUNET_asprintf(&key_file_p1,"https.key");
- if (0 == stat (key_file_p1, &sbuf ))
- {
- if (0 == remove(key_file_p1))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Successfully removed existing private key file `%s'\n",key_file_p1);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed
to remove private key file `%s'\n",key_file_p1);
- }
- if (GNUNET_CONFIGURATION_have_value
(p->cfg,"transport-https", "CERT_FILE"))
- GNUNET_CONFIGURATION_get_value_string (p->cfg,
"transport-https", "CERT_FILE", &cert_file_p1);
- if (cert_file_p1==NULL)
- GNUNET_asprintf(&cert_file_p1,"https.cert");
- if (0 == stat (cert_file_p1, &sbuf ))
- {
- if (0 == remove(cert_file_p1))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Successfully removed existing certificate file `%s'\n",cert_file_p1);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed
to remove existing certificate file `%s'\n",cert_file_p1);
- }
- }
- else if (p==&p2)
- {
- if (GNUNET_CONFIGURATION_have_value (p->cfg,
-
"transport-https", "KEY_FILE"))
- GNUNET_CONFIGURATION_get_value_string (p->cfg,
"transport-https", "KEY_FILE", &key_file_p2);
- if (key_file_p2==NULL)
- GNUNET_asprintf(&key_file_p2,"https.key");
- if (0 == stat (key_file_p2, &sbuf ))
- {
- if (0 == remove(key_file_p2))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Successfully removed existing private key file `%s'\n",key_file_p2);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed
to remove private key file `%s'\n",key_file_p2);
- }
- if (GNUNET_CONFIGURATION_have_value
(p->cfg,"transport-https", "CERT_FILE"))
- GNUNET_CONFIGURATION_get_value_string (p->cfg,
"transport-https", "CERT_FILE", &cert_file_p2);
- if (cert_file_p2==NULL)
- GNUNET_asprintf(&cert_file_p2,"https.cert");
- if (0 == stat (cert_file_p2, &sbuf ))
- {
- if (0 == remove(cert_file_p2))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Successfully removed existing certificate file `%s'\n",cert_file_p2);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed
to remove existing certificate file `%s'\n",cert_file_p2);
- }
- }
- }
-
p->th = GNUNET_TRANSPORT_connect (p->cfg,
NULL, p,
¬ify_receive,
¬ify_connect, ¬ify_disconnect);
GNUNET_assert (p->th != NULL);
+
+ GNUNET_SCHEDULER_cancel (die_task);
+ die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT_TRANSMIT,
+ &end_badly, NULL);
}
@@ -400,45 +365,6 @@
stop_arm (&p1);
// stop_arm (&p2);
- if (is_https)
- {
- struct stat sbuf;
- if (0 == stat (cert_file_p1, &sbuf ))
- {
- if (0 == remove(cert_file_p1))
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully
removed existing certificate file `%s'\n",cert_file_p1);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to
remove certfile `%s'\n",cert_file_p1);
- }
-
- if (0 == stat (key_file_p1, &sbuf ))
- {
- if (0 == remove(key_file_p1))
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully
removed private key file `%s'\n",key_file_p1);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to
private key file `%s'\n",key_file_p1);
- }
-
- if (0 == stat (cert_file_p2, &sbuf ))
- {
- if (0 == remove(cert_file_p2))
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully
removed existing certificate file `%s'\n",cert_file_p2);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to
remove certfile `%s'\n",cert_file_p2);
- }
-
- if (0 == stat (key_file_p2, &sbuf ))
- {
- if (0 == remove(key_file_p2))
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully
removed private key file `%s'\n",key_file_p2);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to
private key file `%s'\n",key_file_p2);
- }
- GNUNET_free(key_file_p1);
- GNUNET_free(key_file_p2);
- GNUNET_free(cert_file_p1);
- GNUNET_free(cert_file_p2);
- }
return ok;
}
Modified: gnunet/src/transport/test_transport_ats_peer1.conf
===================================================================
--- gnunet/src/transport/test_transport_ats_peer1.conf 2011-03-28 15:05:21 UTC
(rev 14755)
+++ gnunet/src/transport/test_transport_ats_peer1.conf 2011-03-28 15:46:25 UTC
(rev 14756)
@@ -41,7 +41,7 @@
[transport]
PLUGINS = tcp unix
-DEBUG = NO
+#DEBUG = YES
#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
#PREFIX = valgrind --tool=memcheck --leak-check=full --log-file=transport%p
ACCEPT_FROM6 = ::1;
@@ -87,6 +87,7 @@
HOSTNAME = localhost
PORT = 12367
UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
+DEBUG = YES
[arm]
DEFAULTSERVICES = transport
Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h 2011-03-28 15:05:21 UTC (rev 14755)
+++ gnunet/src/transport/transport.h 2011-03-28 15:46:25 UTC (rev 14756)
@@ -31,8 +31,8 @@
#include "gnunet_transport_service.h"
/* Minimum time between to calculations*/
-#define ATS_MIN_INTERVAL
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20)
-#define ATS_EXEC_INTERVAL
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60)
+#define ATS_MIN_INTERVAL
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1)
+#define ATS_EXEC_INTERVAL
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
#define ATS_MAX_EXEC_DURATION
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 500)
#define ATS_MAX_ITERATIONS INT_MAX
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14756 - gnunet/src/transport,
gnunet <=