2 This file is part of GNUnet.
3 Copyright (C) 2010-2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
16 * @file ats/perf_ats.c
17 * @brief ats benchmark: start peers and modify preferences, monitor change over time
18 * @author Christian Grothoff
19 * @author Matthias Wachs
22 #include "gnunet_util_lib.h"
23 #include "gnunet_testbed_service.h"
24 #include "gnunet_ats_service.h"
25 #include "gnunet_core_service.h"
26 #include "ats-testing.h"
28 #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
29 #define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
30 #define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500)
31 #define TESTNAME_PREFIX "perf_ats_"
32 #define DEFAULT_SLAVES_NUM 2
33 #define DEFAULT_MASTERS_NUM 1
35 #define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
36 #define TEST_ATS_PREFRENCE_START 1.0
37 #define TEST_ATS_PREFRENCE_DELTA 1.0
39 #define TEST_MESSAGE_TYPE_PING 12345
40 #define TEST_MESSAGE_TYPE_PONG 12346
41 #define TEST_MESSAGE_SIZE 1000
42 #define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
45 * Information about a benchmarking partner
47 struct BenchmarkPartner
50 * The peer itself this partner belongs to
52 struct BenchmarkPeer *me;
57 struct BenchmarkPeer *dest;
60 * Core transmit handles
62 struct GNUNET_CORE_TransmitHandle *cth;
65 * Transport transmit handles
67 struct GNUNET_TRANSPORT_TransmitHandle *tth;
70 * Timestamp to calculate communication layer delay
72 struct GNUNET_TIME_Absolute last_message_sent;
75 * Accumulated RTT for all messages
77 unsigned int total_app_rtt;
80 * Number of messages sent to this partner
82 unsigned int messages_sent;
85 * Number of bytes sent to this partner
87 unsigned int bytes_sent;
90 * Number of messages received from this partner
92 unsigned int messages_received;
95 * Number of bytes received from this partner
97 unsigned int bytes_received;
99 /* Current ATS properties */
101 uint32_t ats_distance;
105 uint32_t bandwidth_in;
107 uint32_t bandwidth_out;
109 uint32_t ats_utilization_up;
111 uint32_t ats_utilization_down;
113 uint32_t ats_network_type;
115 uint32_t ats_cost_wan;
117 uint32_t ats_cost_lan;
119 uint32_t ats_cost_wlan;
124 * Information we track for a peer in the testbed.
129 * Handle with testbed.
131 struct GNUNET_TESTBED_Peer *peer;
139 * Is this peer a measter: GNUNET_YES/GNUNET_NO
146 struct GNUNET_PeerIdentity id;
149 * Testbed operation to get peer information
151 struct GNUNET_TESTBED_Operation *peer_id_op;
154 * Testbed operation to connect to ATS performance service
156 struct GNUNET_TESTBED_Operation *ats_perf_op;
159 * Testbed operation to connect to core
161 struct GNUNET_TESTBED_Operation *comm_op;
164 * ATS performance handle
166 struct GNUNET_ATS_PerformanceHandle *ats_perf_handle;
170 * Testbed connect operations to connect masters to slaves
172 struct TestbedConnectOperation *core_connect_ops;
177 struct GNUNET_CORE_Handle *ch;
182 struct GNUNET_TRANSPORT_Handle *th;
186 * Peer to set ATS preferences for
188 struct BenchmarkPeer *pref_partner;
194 struct GNUNET_SCHEDULER_Task * ats_task;
203 * Array of partners with num_slaves entries (if master) or
204 * num_master entries (if slave)
206 struct BenchmarkPartner *partners;
214 * Number of core connections
216 int core_connections;
220 * Number of connections to slave peers
222 int core_slave_connections;
225 * Total number of messages this peer has sent
227 unsigned int total_messages_sent;
230 * Total number of bytes this peer has sent
232 unsigned int total_bytes_sent;
235 * Total number of messages this peer has received
237 unsigned int total_messages_received;
240 * Total number of bytes this peer has received
242 unsigned int total_bytes_received;
246 /* end of file perf_ats.h */