[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27064 - in gnunet: . src/nse
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27064 - in gnunet: . src/nse |
Date: |
Wed, 8 May 2013 11:52:41 +0200 |
Author: harsha
Date: 2013-05-08 11:52:40 +0200 (Wed, 08 May 2013)
New Revision: 27064
Modified:
gnunet/configure.ac
gnunet/src/nse/Makefile.am
gnunet/src/nse/gnunet-service-nse.c
Log:
- generate histograms based on configure option --enable-nse-histogram
Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2013-05-08 09:52:08 UTC (rev 27063)
+++ gnunet/configure.ac 2013-05-08 09:52:40 UTC (rev 27064)
@@ -967,6 +967,27 @@
AM_CONDITIONAL([ENABLE_LL], [test "x$ll" = "x1"])
AC_DEFINE_UNQUOTED([ENABLE_LL], [$ll], [Build with LL support])
+# Check if NSE has to send timestamp information to testbed logger for
+# generating histogram of messages received
+AC_MSG_CHECKING(if NSE has to send timestamp information to testbed logger)
+AC_ARG_ENABLE([nse-histogram],
+ [AS_HELP_STRING([--enable-nse-histogram],
+ [have NSE send timestamp information to testbed logger for generating
+ histogram of received messages. NOT useful for production (default is
+ NO)])],
+ [if test "x$enableval" = "xno"
+ then
+ nse_histogram=0
+ else
+ nse_histogram=1
+ fi],
+ [nse_histogram=0
+ enable_nse_histogram=no])
+AC_MSG_RESULT($enable_nse_histogram)
+AM_CONDITIONAL([ENABLE_NSE_HISTOGRAM], [test "x$nse_histogram" = "x1"])
+AC_DEFINE_UNQUOTED([ENABLE_NSE_HISTOGRAM], [$nse_histogram],
+ [have NSE send timestamp information to testbed logger])
+
# should 'make check' run tests?
AC_MSG_CHECKING(whether to run tests)
AC_ARG_ENABLE([testruns],
Modified: gnunet/src/nse/Makefile.am
===================================================================
--- gnunet/src/nse/Makefile.am 2013-05-08 09:52:08 UTC (rev 27063)
+++ gnunet/src/nse/Makefile.am 2013-05-08 09:52:40 UTC (rev 27064)
@@ -57,7 +57,14 @@
$(GN_LIBINTL)
gnunet_service_nse_DEPENDENCIES = \
libgnunetnse.la
+if ENABLE_NSE_HISTOGRAM
+ gnunet_service_nse_LDADD += \
+ $(top_builddir)/src/testbed/libgnunettestbedlogger.la
+ gnunet_service_nse_DEPENDENCIES += \
+ $(top_builddir)/src/testbed/libgnunettestbedlogger.la
+endif
+
if HAVE_BENCHMARKS
MULTIPEER_TEST = test_nse_multipeer
endif
Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2013-05-08 09:52:08 UTC (rev 27063)
+++ gnunet/src/nse/gnunet-service-nse.c 2013-05-08 09:52:40 UTC (rev 27064)
@@ -44,6 +44,9 @@
#include "gnunet_statistics_service.h"
#include "gnunet_core_service.h"
#include "gnunet_nse_service.h"
+#if ENABLE_NSE_HISTOGRAM
+#include "gnunet_testbed_logger_service.h"
+#endif
#include "nse.h"
#include <gcrypt.h>
@@ -56,14 +59,6 @@
#define USE_RANDOM_DELAYS GNUNET_YES
/**
- * Should we generate a histogram with the time stamps of when we received
- * NSE messages to disk? (for performance evaluation only, not useful in
- * production). The associated code should also probably be removed
- * once we're done with experiments.
- */
-#define ENABLE_HISTOGRAM GNUNET_NO
-
-/**
* Over how many values do we calculate the weighted average?
*/
#define HISTORY_SIZE 64
@@ -92,11 +87,11 @@
*/
static struct GNUNET_TIME_Relative proof_find_delay;
-#if ENABLE_HISTOGRAM
+#if ENABLE_NSE_HISTOGRAM
/**
* Handle for writing when we received messages to disk.
*/
-static struct GNUNET_BIO_WriteHandle *wh;
+static struct GNUNET_TESTBED_LOGGER_Handle *lh;
#endif
@@ -128,7 +123,7 @@
*/
int previous_round;
-#if ENABLE_HISTOGRAM
+#if ENABLE_NSE_HISTOGRAM
/**
* Amount of messages received from this peer on this round.
@@ -636,7 +631,7 @@
GNUNET_STATISTICS_update (stats, "# flood messages started", 1, GNUNET_NO);
GNUNET_STATISTICS_update (stats, "# flood messages transmitted", 1,
GNUNET_NO);
-#if ENABLE_HISTOGRAM
+#if ENABLE_NSE_HISTOGRAM
peer_entry->transmitted_messages++;
peer_entry->last_transmitted_size =
ntohl(size_estimate_messages[idx].matching_bits);
@@ -751,7 +746,7 @@
GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
peer_entry->previous_round = GNUNET_NO;
}
-#if ENABLE_HISTOGRAM
+#if ENABLE_NSE_HISTOGRAM
if (peer_entry->received_messages > 1)
GNUNET_STATISTICS_update(stats, "# extra messages",
peer_entry->received_messages - 1, GNUNET_NO);
@@ -1039,9 +1034,13 @@
uint32_t matching_bits;
unsigned int idx;
-#if ENABLE_HISTOGRAM
- if (NULL != wh)
- GNUNET_break (GNUNET_OK == GNUNET_BIO_write_int64 (wh,
GNUNET_TIME_absolute_get ().abs_value));
+#if ENABLE_NSE_HISTOGRAM
+ {
+ uint64_t t;
+
+ t = GNUNET_TIME_absolute_get().abs_value;
+ GNUNET_TESTBED_LOGGER_write (lh, &t, sizeof (uint64_t));
+ }
#endif
incoming_flood = (const struct GNUNET_NSE_FloodMessage *) message;
GNUNET_STATISTICS_update (stats, "# flood messages received", 1, GNUNET_NO);
@@ -1072,7 +1071,7 @@
GNUNET_break (0);
return GNUNET_OK;
}
-#if ENABLE_HISTOGRAM
+#if ENABLE_NSE_HISTOGRAM
peer_entry->received_messages++;
if (peer_entry->transmitted_messages > 0 &&
peer_entry->last_transmitted_size >= matching_bits)
@@ -1317,12 +1316,9 @@
GNUNET_CRYPTO_ecc_key_free (my_private_key);
my_private_key = NULL;
}
-#if ENABLE_HISTOGRAM
- if (NULL != wh)
- {
- GNUNET_break (GNUNET_OK == GNUNET_BIO_write_close (wh));
- wh = NULL;
- }
+#if ENABLE_NSE_HISTOGRAM
+ GNUNET_TESTBED_LOGGER_disconnect (lh);
+ lh = NULL;
#endif
}
@@ -1450,36 +1446,6 @@
GNUNET_SCHEDULER_shutdown ();
return;
}
-#if ENABLE_HISTOGRAM
- if (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "HISTOGRAM_DIR",
&proof))
- {
- char *hostname;
- char *hgram_file;
- unsigned long long peer_id;
-
- hgram_file = NULL;
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",
- "PEERID",
&peer_id))
- (void) GNUNET_asprintf (&hgram_file, "%s/%llu.hist", proof, peer_id);
- else
- {
- hostname = GNUNET_malloc (GNUNET_OS_get_hostname_max_length ());
- if (0 == gethostname (hostname, HOST_NAME_MAX))
- (void) GNUNET_asprintf (&hgram_file, "%s/%s_%jd.hist",
- proof, hostname, (intmax_t) getpid());
- else
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "gethostname");
- GNUNET_free (hostname);
- }
- if (NULL != hgram_file)
- {
- wh = GNUNET_BIO_write_open (hgram_file);
- GNUNET_free (hgram_file);
- }
- GNUNET_free (proof);
- }
-#endif
stats = GNUNET_STATISTICS_create ("nse", cfg);
GNUNET_SERVER_resume (srv);
}
@@ -1536,6 +1502,16 @@
GNUNET_SCHEDULER_shutdown ();
return;
}
+#if ENABLE_NSE_HISTOGRAM
+ if (NULL == (lh = GNUNET_TESTBED_LOGGER_connect (cfg)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Cannot connect to the testbed logger. Exiting.\n");
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+#endif
+
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
NULL);
GNUNET_SERVER_suspend (srv);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27064 - in gnunet: . src/nse,
gnunet <=