[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29379 - gnunet/src/ats-tests
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29379 - gnunet/src/ats-tests |
Date: |
Wed, 18 Sep 2013 15:27:45 +0200 |
Author: wachs
Date: 2013-09-18 15:27:45 +0200 (Wed, 18 Sep 2013)
New Revision: 29379
Added:
gnunet/src/ats-tests/perf_ats.h
Removed:
gnunet/src/ats-tests/perf_ats_logging.h
Modified:
gnunet/src/ats-tests/perf_ats.c
gnunet/src/ats-tests/perf_ats_logging.c
Log:
collecting log functionality
mv structs to perf_ats header
Modified: gnunet/src/ats-tests/perf_ats.c
===================================================================
--- gnunet/src/ats-tests/perf_ats.c 2013-09-18 13:14:15 UTC (rev 29378)
+++ gnunet/src/ats-tests/perf_ats.c 2013-09-18 13:27:45 UTC (rev 29379)
@@ -28,7 +28,7 @@
#include "gnunet_testbed_service.h"
#include "gnunet_ats_service.h"
#include "gnunet_core_service.h"
-#include "perf_ats_logging.h"
+#include "perf_ats.h"
#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
10)
#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 5)
@@ -46,52 +46,6 @@
#define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 1)
/**
- * Information about a benchmarking partner
- */
-struct BenchmarkPartner
-{
- /**
- * The peer itself this partner belongs to
- */
- struct BenchmarkPeer *me;
-
- /**
- * The partner peer
- */
- struct BenchmarkPeer *dest;
-
- /**
- * Core transmit handles
- */
- struct GNUNET_CORE_TransmitHandle *cth;
-
- /**
- * Transport transmit handles
- */
- struct GNUNET_TRANSPORT_TransmitHandle *tth;
-
- /**
- * Number of messages sent to this partner
- */
- unsigned int messages_sent;
-
- /**
- * Number of bytes sent to this partner
- */
- unsigned int bytes_sent;
-
- /**
- * Number of messages received from this partner
- */
- unsigned int messages_received;
-
- /**
- * Number of bytes received from this partner
- */
- unsigned int bytes_received;
-};
-
-/**
* Connect peers with testbed
*/
struct TestbedConnectOperation
@@ -113,123 +67,6 @@
};
/**
- * Information we track for a peer in the testbed.
- */
-struct BenchmarkPeer
-{
- /**
- * Handle with testbed.
- */
- struct GNUNET_TESTBED_Peer *peer;
-
- /**
- * Unique identifier
- */
- int no;
-
- /**
- * Is this peer a measter: GNUNET_YES/GNUNET_NO
- */
- int master;
-
- /**
- * Peer ID
- */
- struct GNUNET_PeerIdentity id;
-
- /**
- * Testbed operation to get peer information
- */
- struct GNUNET_TESTBED_Operation *peer_id_op;
-
- /**
- * Testbed operation to connect to ATS performance service
- */
- struct GNUNET_TESTBED_Operation *ats_perf_op;
-
- /**
- * Testbed operation to connect to core
- */
- struct GNUNET_TESTBED_Operation *comm_op;
-
- /**
- * ATS performance handle
- */
- struct GNUNET_ATS_PerformanceHandle *ats_perf_handle;
-
- /**
- * Masters only:
- * Testbed connect operations to connect masters to slaves
- */
- struct TestbedConnectOperation *core_connect_ops;
-
- /**
- * Core handle
- */
- struct GNUNET_CORE_Handle *ch;
-
- /**
- * Core handle
- */
- struct GNUNET_TRANSPORT_Handle *th;
-
- /**
- * Masters only:
- * Peer to set ATS preferences for
- */
- struct BenchmarkPeer *pref_partner;
-
- /**
- * Masters only
- * Progress task
- */
- GNUNET_SCHEDULER_TaskIdentifier ats_task;
-
- /**
- * Masters only
- * Progress task
- */
- double pref_value;
-
- /**
- * Array of partners with num_slaves entries (if master) or
- * num_master entries (if slave)
- */
- struct BenchmarkPartner *partners;
-
- /**
- * Number of core connections
- */
- int core_connections;
-
- /**
- * Masters only:
- * Number of connections to slave peers
- */
- int core_slave_connections;
-
- /**
- * Total number of messages this peer has sent
- */
- unsigned int total_messages_sent;
-
- /**
- * Total number of bytes this peer has sent
- */
- unsigned int total_bytes_sent;
-
- /**
- * Total number of messages this peer has received
- */
- unsigned int total_messages_received;
-
- /**
- * Total number of bytes this peer has received
- */
- unsigned int total_bytes_received;
-};
-
-/**
* Overall state of the performance benchmark
*/
struct BenchmarkState
@@ -614,7 +451,7 @@
mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]);
}
if (GNUNET_YES == logging)
- perf_logging_start();
+ perf_logging_start (mps, num_masters);
}
static void
@@ -1209,6 +1046,7 @@
mps[c_m].pref_value = TEST_ATS_PREFRENCE_START;
mps[c_m].partners =
GNUNET_malloc (num_slaves * sizeof (struct BenchmarkPeer));
+ mps[c_m].num_partners = num_slaves;
/* Initialize partners */
for (c_s = 0; c_s < num_slaves; c_s++)
{
@@ -1228,6 +1066,7 @@
sps[c_s].master = GNUNET_NO;
sps[c_s].partners =
GNUNET_malloc (num_masters * sizeof (struct BenchmarkPeer));
+ sps[c_s].num_partners = num_masters;
/* Initialize partners */
for (c_m = 0; c_m < num_masters; c_m++)
{
Added: gnunet/src/ats-tests/perf_ats.h
===================================================================
--- gnunet/src/ats-tests/perf_ats.h (rev 0)
+++ gnunet/src/ats-tests/perf_ats.h 2013-09-18 13:27:45 UTC (rev 29379)
@@ -0,0 +1,224 @@
+/*
+ This file is part of GNUnet.
+ (C) 2010-2013 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+/**
+ * @file ats/perf_ats.c
+ * @brief ats benchmark: start peers and modify preferences, monitor change
over time
+ * @author Christian Grothoff
+ * @author Matthias Wachs
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testbed_service.h"
+#include "gnunet_ats_service.h"
+#include "gnunet_core_service.h"
+
+#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
10)
+#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 5)
+#define TESTNAME_PREFIX "perf_ats_"
+#define DEFAULT_SLAVES_NUM 3
+#define DEFAULT_MASTERS_NUM 1
+
+#define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 1)
+#define TEST_ATS_PREFRENCE_START 1.0
+#define TEST_ATS_PREFRENCE_DELTA 1.0
+
+#define TEST_MESSAGE_TYPE_PING 12345
+#define TEST_MESSAGE_TYPE_PONG 12346
+#define TEST_MESSAGE_SIZE 1000
+#define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 1)
+
+/**
+ * Information about a benchmarking partner
+ */
+struct BenchmarkPartner
+{
+ /**
+ * The peer itself this partner belongs to
+ */
+ struct BenchmarkPeer *me;
+
+ /**
+ * The partner peer
+ */
+ struct BenchmarkPeer *dest;
+
+ /**
+ * Core transmit handles
+ */
+ struct GNUNET_CORE_TransmitHandle *cth;
+
+ /**
+ * Transport transmit handles
+ */
+ struct GNUNET_TRANSPORT_TransmitHandle *tth;
+
+ /**
+ * Number of messages sent to this partner
+ */
+ unsigned int messages_sent;
+
+ /**
+ * Number of bytes sent to this partner
+ */
+ unsigned int bytes_sent;
+
+ /**
+ * Number of messages received from this partner
+ */
+ unsigned int messages_received;
+
+ /**
+ * Number of bytes received from this partner
+ */
+ unsigned int bytes_received;
+};
+
+
+/**
+ * Information we track for a peer in the testbed.
+ */
+struct BenchmarkPeer
+{
+ /**
+ * Handle with testbed.
+ */
+ struct GNUNET_TESTBED_Peer *peer;
+
+ /**
+ * Unique identifier
+ */
+ int no;
+
+ /**
+ * Is this peer a measter: GNUNET_YES/GNUNET_NO
+ */
+ int master;
+
+ /**
+ * Peer ID
+ */
+ struct GNUNET_PeerIdentity id;
+
+ /**
+ * Testbed operation to get peer information
+ */
+ struct GNUNET_TESTBED_Operation *peer_id_op;
+
+ /**
+ * Testbed operation to connect to ATS performance service
+ */
+ struct GNUNET_TESTBED_Operation *ats_perf_op;
+
+ /**
+ * Testbed operation to connect to core
+ */
+ struct GNUNET_TESTBED_Operation *comm_op;
+
+ /**
+ * ATS performance handle
+ */
+ struct GNUNET_ATS_PerformanceHandle *ats_perf_handle;
+
+ /**
+ * Masters only:
+ * Testbed connect operations to connect masters to slaves
+ */
+ struct TestbedConnectOperation *core_connect_ops;
+
+ /**
+ * Core handle
+ */
+ struct GNUNET_CORE_Handle *ch;
+
+ /**
+ * Core handle
+ */
+ struct GNUNET_TRANSPORT_Handle *th;
+
+ /**
+ * Masters only:
+ * Peer to set ATS preferences for
+ */
+ struct BenchmarkPeer *pref_partner;
+
+ /**
+ * Masters only
+ * Progress task
+ */
+ GNUNET_SCHEDULER_TaskIdentifier ats_task;
+
+ /**
+ * Masters only
+ * Progress task
+ */
+ double pref_value;
+
+ /**
+ * Array of partners with num_slaves entries (if master) or
+ * num_master entries (if slave)
+ */
+ struct BenchmarkPartner *partners;
+
+ /**
+ * Number of partners
+ */
+ int num_partners;
+
+ /**
+ * Number of core connections
+ */
+ int core_connections;
+
+ /**
+ * Masters only:
+ * Number of connections to slave peers
+ */
+ int core_slave_connections;
+
+ /**
+ * Total number of messages this peer has sent
+ */
+ unsigned int total_messages_sent;
+
+ /**
+ * Total number of bytes this peer has sent
+ */
+ unsigned int total_bytes_sent;
+
+ /**
+ * Total number of messages this peer has received
+ */
+ unsigned int total_messages_received;
+
+ /**
+ * Total number of bytes this peer has received
+ */
+ unsigned int total_bytes_received;
+};
+
+
+void
+perf_logging_stop ();
+
+void
+perf_logging_start (struct BenchmarkPeer *masters, int num_masters);
+
+
+/* end of file perf_ats.h */
Modified: gnunet/src/ats-tests/perf_ats_logging.c
===================================================================
--- gnunet/src/ats-tests/perf_ats_logging.c 2013-09-18 13:14:15 UTC (rev
29378)
+++ gnunet/src/ats-tests/perf_ats_logging.c 2013-09-18 13:27:45 UTC (rev
29379)
@@ -25,18 +25,79 @@
*/
#include "platform.h"
#include "gnunet_util_lib.h"
+#include "perf_ats.h"
+#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 500)
+
+static GNUNET_SCHEDULER_TaskIdentifier log_task;
+
+static struct BenchmarkPeer *peers;
+static int num_peers;
+
+static void
+write_to_file ()
+{
+
+}
+
+static void
+collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ int c_m;
+ int c_s;
+ log_task = GNUNET_SCHEDULER_NO_TASK;
+
+ struct BenchmarkPeer *m;
+ struct BenchmarkPartner *p;
+
+ for (c_m = 0; c_m < num_peers; c_m++)
+ {
+ m = &peers[c_m];
+ for (c_s = 0; c_s < m->num_partners; c_s++)
+ {
+ p = &peers[c_m].partners[c_s];
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "Master [%u]: slave [%u]\n",
+ m->no, p->dest->no);
+ }
+ }
+
+ if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
+ return;
+
+ log_task = GNUNET_SCHEDULER_add_delayed (LOGGING_FREQUENCY,
+ &collect_log_task, NULL);
+}
+
+
void
perf_logging_stop ()
{
+ struct GNUNET_SCHEDULER_TaskContext tc;
+
+ if (GNUNET_SCHEDULER_NO_TASK != log_task)
+ GNUNET_SCHEDULER_cancel (log_task);
+ log_task = GNUNET_SCHEDULER_NO_TASK;
+ tc.reason = GNUNET_SCHEDULER_REASON_SHUTDOWN;
+ collect_log_task (NULL, &tc);
+
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- _("Start logging\n"));
+ _("Stop logging\n"));
+
+ write_to_file ();
}
void
-perf_logging_start ()
+perf_logging_start (struct BenchmarkPeer *masters, int num_masters)
{
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
_("Start logging\n"));
+
+ peers = masters;
+ num_peers = num_masters;
+
+ /* Schedule logging task */
+ log_task = GNUNET_SCHEDULER_add_now (&collect_log_task, NULL);
}
/* end of file perf_ats_logging.c */
+
Deleted: gnunet/src/ats-tests/perf_ats_logging.h
===================================================================
--- gnunet/src/ats-tests/perf_ats_logging.h 2013-09-18 13:14:15 UTC (rev
29378)
+++ gnunet/src/ats-tests/perf_ats_logging.h 2013-09-18 13:27:45 UTC (rev
29379)
@@ -1,35 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2010-2013 Christian Grothoff (and other contributing authors)
-
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-/**
- * @file ats/perf_ats_logging.c
- * @brief ats benchmark: logging for performance tests
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-
-void
-perf_logging_stop ();
-
-void
-perf_logging_start ();
-
-/* end of file perf_ats_logging.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29379 - gnunet/src/ats-tests,
gnunet <=