From a94bcd89e2a7980dd9de9b17d3395002951240e5 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Wed, 18 Sep 2013 13:27:45 +0000 Subject: collecting log functionality mv structs to perf_ats header --- src/ats-tests/perf_ats.h | 224 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 src/ats-tests/perf_ats.h (limited to 'src/ats-tests/perf_ats.h') diff --git a/src/ats-tests/perf_ats.h b/src/ats-tests/perf_ats.h new file mode 100644 index 000000000..b8e0f1eb7 --- /dev/null +++ b/src/ats-tests/perf_ats.h @@ -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 */ -- cgit v1.2.3