Tool to help benchmark the transport subsystem. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_ats_service.h"
#include "gnunet_transport_service.h"
Go to the source code of this file.
Data Structures | |
struct | Iteration |
Macros | |
#define | CONNECT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
Timeout for a connections. More... | |
#define | DEFAULT_MESSAGE_SIZE 1024 |
Benchmarking block size in bye. More... | |
#define | DEFAULT_MESSAGE_COUNT 1024 |
Benchmarking message count. More... | |
#define | DEFAULT_ITERATION_COUNT 1 |
Benchmarking iteration count. More... | |
Functions | |
static void | shutdown_task (void *cls) |
Task run in monitor mode when the user presses CTRL-C to abort. More... | |
static void | iteration_done () |
static void | send_msg (void *cls) |
Function called to notify a client about the socket begin ready to queue more data. More... | |
static void | iteration_start () |
static void * | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *m) |
Function called to notify transport users that another peer connected to us. More... | |
static void | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls) |
Function called to notify transport users that another peer disconnected from us. More... | |
static int | check_dummy (void *cls, const struct GNUNET_MessageHeader *message) |
Function called by the transport for each received message. More... | |
static void | handle_dummy (void *cls, const struct GNUNET_MessageHeader *message) |
Function called by the transport for each received message. More... | |
static int | blacklist_cb (void *cls, const struct GNUNET_PeerIdentity *peer) |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *mycfg) |
Main function that will be run by the scheduler. More... | |
int | main (int argc, char *const *argv) |
Variables | |
static int | benchmark_send |
Option -s. More... | |
static int | benchmark_receive |
Option -b. More... | |
static unsigned int | benchmark_count |
Option -n. More... | |
static unsigned int | benchmark_iterations |
Option -i. More... | |
static unsigned int | benchmark_size |
Option -m. More... | |
static unsigned int | benchmark_running |
Benchmark running. More... | |
static char * | cpid |
Which peer should we connect to? More... | |
static struct GNUNET_TRANSPORT_CoreHandle * | handle |
Handle to transport service. More... | |
static struct GNUNET_ATS_ConnectivityHandle * | ats |
Handle to ATS service. More... | |
static struct GNUNET_CONFIGURATION_Handle * | cfg |
Configuration handle. More... | |
static struct GNUNET_ATS_ConnectivitySuggestHandle * | ats_sh |
Try_connect handle. More... | |
static struct Iteration * | ihead |
static struct Iteration * | itail |
static int | ret |
Global return value (0 success). More... | |
static struct GNUNET_MQ_Handle * | mq |
Handle for transmissions. More... | |
static struct GNUNET_TRANSPORT_Blacklist * | bl_handle |
static struct GNUNET_PeerIdentity | pid |
Identity of the peer we transmit to / connect to. More... | |
static unsigned int | verbosity |
Selected level of verbosity. More... | |
Tool to help benchmark the transport subsystem.
This utility can be used to benchmark a transport mechanism for GNUnet.
Definition in file gnunet-transport-profiler.c.
#define CONNECT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
Timeout for a connections.
Definition at line 56 of file gnunet-transport-profiler.c.
#define DEFAULT_MESSAGE_SIZE 1024 |
Benchmarking block size in bye.
Definition at line 62 of file gnunet-transport-profiler.c.
#define DEFAULT_MESSAGE_COUNT 1024 |
Benchmarking message count.
Definition at line 67 of file gnunet-transport-profiler.c.
#define DEFAULT_ITERATION_COUNT 1 |
Benchmarking iteration count.
Definition at line 72 of file gnunet-transport-profiler.c.
|
static |
Task run in monitor mode when the user presses CTRL-C to abort.
Stops monitoring activity.
cls | NULL |
Definition at line 164 of file gnunet-transport-profiler.c.
References _, ats, ats_sh, benchmark_count, benchmark_receive, benchmark_send, benchmark_size, bl_handle, Iteration::dur, duration, GNUNET_ATS_connectivity_done(), GNUNET_ATS_connectivity_suggest_cancel(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get_duration(), GNUNET_TRANSPORT_blacklist_cancel(), GNUNET_TRANSPORT_core_disconnect(), GNUNET_YES, handle, ihead, itail, Iteration::next, Iteration::rate, GNUNET_TIME_Relative::rel_value_us, start_time, traffic_received, and verbosity.
Referenced by run().
|
static |
Definition at line 356 of file gnunet-transport-profiler.c.
References benchmark_iterations, benchmark_running, Iteration::dur, GNUNET_NO, GNUNET_SCHEDULER_shutdown(), GNUNET_TIME_absolute_get_duration(), itail, iteration_start(), and Iteration::start.
Referenced by send_msg().
|
static |
Function called to notify a client about the socket begin ready to queue more data.
buf will be NULL and size zero if the socket was closed for writing in the meantime.
cls | closure |
size | number of bytes available in buf |
buf | where the callee should write the message |
Definition at line 309 of file gnunet-transport-profiler.c.
References benchmark_count, benchmark_size, env, GNUNET_MESSAGE_TYPE_DUMMY, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), itail, iteration_done(), m, mq, Iteration::msgs_sent, and verbosity.
Referenced by iteration_start(), and reconnect().
|
static |
Definition at line 334 of file gnunet-transport-profiler.c.
References benchmark_count, benchmark_running, benchmark_send, benchmark_size, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_new, GNUNET_TIME_absolute_get(), GNUNET_YES, ihead, itail, ret, send_msg(), Iteration::start, and verbosity.
Referenced by iteration_done(), and notify_connect().
|
static |
Function called to notify transport users that another peer connected to us.
cls | closure |
peer | the peer that connected |
m | message queue for transmissions |
Definition at line 382 of file gnunet-transport-profiler.c.
References GNUNET_i2s(), iteration_start(), m, mq, peer, pid, and verbosity.
Referenced by run().
|
static |
Function called to notify transport users that another peer disconnected from us.
cls | closure |
peer | the peer that disconnected |
internal_cls | NULL |
Definition at line 409 of file gnunet-transport-profiler.c.
References benchmark_running, GNUNET_i2s(), GNUNET_YES, mq, peer, and pid.
Referenced by run().
|
static |
Function called by the transport for each received message.
cls | closure |
message | the message |
Definition at line 434 of file gnunet-transport-profiler.c.
References GNUNET_OK.
|
static |
Function called by the transport for each received message.
cls | closure |
message | the message |
Definition at line 447 of file gnunet-transport-profiler.c.
References benchmark_receive, GNUNET_MessageHeader::size, and verbosity.
|
static |
Definition at line 459 of file gnunet-transport-profiler.c.
References GNUNET_i2s(), GNUNET_OK, GNUNET_SYSERR, peer, pid, and verbosity.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
mycfg | configuration |
Definition at line 480 of file gnunet-transport-profiler.c.
References ats, ats_sh, benchmark_count, benchmark_receive, benchmark_send, benchmark_size, bl_handle, blacklist_cb(), cfg, cpid, dummy, GNUNET_ATS_connectivity_done(), GNUNET_ATS_connectivity_init(), GNUNET_ATS_connectivity_suggest(), GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_i2s(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_MESSAGE_TYPE_DUMMY, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_TRANSPORT_blacklist(), GNUNET_TRANSPORT_core_connect(), handle, handlers, notify_connect(), notify_disconnect(), pid, GNUNET_PeerIdentity::public_key, ret, shutdown_task(), and verbosity.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Definition at line 565 of file gnunet-transport-profiler.c.
References benchmark_count, benchmark_iterations, benchmark_receive, benchmark_running, benchmark_send, benchmark_size, cpid, DEFAULT_ITERATION_COUNT, DEFAULT_MESSAGE_COUNT, DEFAULT_MESSAGE_SIZE, gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_GETOPT_option_uint(), GNUNET_GETOPT_option_verbose(), GNUNET_NO, GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), options, res, ret, run(), and verbosity.
|
static |
Option -s.
Definition at line 77 of file gnunet-transport-profiler.c.
Referenced by iteration_start(), main(), run(), and shutdown_task().
|
static |
Option -b.
Definition at line 82 of file gnunet-transport-profiler.c.
Referenced by handle_dummy(), main(), run(), and shutdown_task().
|
static |
Option -n.
Definition at line 87 of file gnunet-transport-profiler.c.
Referenced by iteration_start(), main(), run(), send_msg(), and shutdown_task().
|
static |
Option -i.
Definition at line 92 of file gnunet-transport-profiler.c.
Referenced by iteration_done(), and main().
|
static |
Option -m.
Definition at line 97 of file gnunet-transport-profiler.c.
Referenced by iteration_start(), main(), run(), send_msg(), and shutdown_task().
|
static |
Benchmark running.
Definition at line 102 of file gnunet-transport-profiler.c.
Referenced by iteration_done(), iteration_start(), main(), and notify_disconnect().
|
static |
Which peer should we connect to?
Definition at line 107 of file gnunet-transport-profiler.c.
Referenced by blacklist_cb(), main(), and run().
|
static |
Handle to transport service.
Definition at line 112 of file gnunet-transport-profiler.c.
Referenced by run(), and shutdown_task().
|
static |
Handle to ATS service.
Definition at line 117 of file gnunet-transport-profiler.c.
Referenced by run(), and shutdown_task().
|
static |
Configuration handle.
Definition at line 122 of file gnunet-transport-profiler.c.
Referenced by run().
|
static |
Try_connect handle.
Definition at line 127 of file gnunet-transport-profiler.c.
Referenced by run(), and shutdown_task().
|
static |
Definition at line 129 of file gnunet-transport-profiler.c.
Referenced by iteration_start(), and shutdown_task().
|
static |
Definition at line 131 of file gnunet-transport-profiler.c.
Referenced by iteration_done(), iteration_start(), send_msg(), and shutdown_task().
|
static |
Global return value (0 success).
Definition at line 136 of file gnunet-transport-profiler.c.
Referenced by iteration_start(), main(), and run().
|
static |
Handle for transmissions.
Definition at line 141 of file gnunet-transport-profiler.c.
Referenced by notify_connect(), notify_disconnect(), and send_msg().
|
static |
Definition at line 143 of file gnunet-transport-profiler.c.
Referenced by run(), and shutdown_task().
|
static |
Identity of the peer we transmit to / connect to.
(equivalent to 'cpid' string).
Definition at line 143 of file gnunet-transport-profiler.c.
Referenced by add_valid_address(), blacklist_cb(), blacklist_check(), check_access(), check_connection_quality(), check_hello(), check_known_address(), check_known_challenge(), check_validation_request_pending(), consider_for_advertising(), consider_peer_for_forwarding(), core_send_connect_info(), cores_send_connect_info(), cores_send_disconnect_info(), create_target(), cummulative_ack(), db_read_whitelist(), detach_terminal(), do_transmit(), dv_neighbour_selection(), dv_neighbour_transmission(), find_list_tunnels(), find_peer_by_pid(), find_queue(), find_target(), flush_respect(), fork_and_exec(), free_ack_cummulator_cb(), free_backtalker_cb(), free_dv_routes_cb(), free_matching_requests(), free_neighbour_cb(), free_peer(), free_request(), free_validation_state_cb(), GAS_plugin_request_connect_start(), GAS_plugin_request_connect_stop(), GCPP_try_path_from_dht(), GDS_NEIGHBOURS_handle_get(), GDS_try_connect(), GDS_u_connect(), GDS_u_try_connect(), get_idx_of_pid(), gns_resolve_name(), GNUNET_CORE_get_mq(), GNUNET_FRIENDS_parse(), GNUNET_HELLO_builder_from_url(), GNUNET_HELLO_builder_new(), GNUNET_HELLO_extract_address(), GNUNET_i2s(), GNUNET_i2s2(), GNUNET_i2s_full(), GNUNET_PEER_intern(), GNUNET_PEER_resolve(), GNUNET_PEER_search(), GNUNET_TRANSPORT_communicator_notify(), gnunet_try_connect(), GSC_SESSIONS_end(), GSC_SESSIONS_solicit(), GST_validation_handle_hello(), handle_ack(), handle_dht_local_hello_offer(), handle_friend(), handle_hello(), handle_p2p_put(), handle_remote_overlay_connect(), handle_search_response(), handle_transport_notify_connect(), handle_transport_notify_excess_bw(), handshake_ack_monotime_cb(), handshake_monotime_cb(), ip_try_connect(), logger_run(), lookup_neighbour(), lookup_virtual_link(), main(), maint_child_death(), netjail_stop_run(), notify_client_connect_info(), notify_client_queues(), notify_connect(), notify_disconnect(), read_cb(), rekey_monotime_cb(), run(), save_list_tunnels(), setup_cipher(), show_peer(), start_address_validation(), start_helper(), stop_peer_request(), suggest_to_connect(), transmit_ping_if_allowed(), update_ax_by_kx(), update_friend_hello(), write_benchmark_data(), and write_pid_file().
|
static |
Selected level of verbosity.
Definition at line 154 of file gnunet-transport-profiler.c.
Referenced by blacklist_cb(), handle_dummy(), iteration_start(), main(), notify_connect(), run(), send_msg(), and shutdown_task().