GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
gnunet-cadet-profiler.c File Reference

Profiler for cadet experiments. More...

#include <stdio.h>
#include "platform.h"
#include "cadet_test_lib.h"
#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
Include dependency graph for gnunet-cadet-profiler.c:

Go to the source code of this file.

Data Structures

struct  CadetPingMessage
 Message type for pings. More...
 
struct  CadetPeer
 Peer description. More...
 

Macros

#define PING   1
 
#define PONG   2
 
#define PING_PERIOD   500
 Paximum ping period in milliseconds. More...
 
#define TIMEOUT   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 120)
 How long until we give up on connecting the peers? More...
 
#define SHORT_TIME   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 300)
 Time to wait for stuff that should be rather fast. More...
 
#define number_rounds   sizeof(rounds) / sizeof(rounds[0])
 Total number of rounds. More...
 

Functions

static void start_test (void *cls)
 START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES. More...
 
static struct GNUNET_TIME_Relative delay_ms_rnd (unsigned int max)
 Calculate a random delay. More...
 
static unsigned int get_index (struct CadetPeer *peer)
 Get the index of a peer in the peers array. More...
 
static void show_end_data (void)
 Show the results of the test (banwidth acheived) and log them to GAUGER. More...
 
static void disconnect_cadet_peers (void *cls)
 Disconnect from cadet services af all peers, call shutdown. More...
 
static void shutdown_task (void *cls)
 Shut down peergroup, clean up. More...
 
static void abort_test (long line)
 Finish test normally: schedule disconnect and shutdown. More...
 
static void stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
 Stats callback. More...
 
static int stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer, const char *subsystem, const char *name, uint64_t value, int is_persistent)
 Process statistic values. More...
 
static void collect_stats (void *cls)
 Task check that keepalives were sent and received. More...
 
static void finish_profiler (void *cls)
 Finish profiler normally. More...
 
static void adjust_running_peers (unsigned int target)
 Set the total number of running peers. More...
 
static void next_rnd (void *cls)
 Move to next round. More...
 
static size_t tmt_rdy_ping (void *cls, size_t size, void *buf)
 Transmit ping callback. More...
 
static size_t tmt_rdy_pong (void *cls, size_t size, void *buf)
 Transmit pong callback. More...
 
static void ping (void *cls)
 Send a ping to destination. More...
 
static void pong (struct GNUNET_CADET_Channel *channel, const struct CadetPingMessage *ping)
 Reply with a pong to origin. More...
 
int ping_handler (void *cls, struct GNUNET_CADET_Channel *channel, void **channel_ctx, const struct GNUNET_MessageHeader *message)
 Function is called whenever a PING message is received. More...
 
int pong_handler (void *cls, struct GNUNET_CADET_Channel *channel, void **channel_ctx, const struct GNUNET_MessageHeader *message)
 Function is called whenever a PONG message is received. More...
 
static void * incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options)
 Method called whenever another peer has added us to a channel the other peer initiated. More...
 
static void channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel, void *channel_ctx)
 Function called whenever an inbound channel is destroyed. More...
 
static struct CadetPeerselect_random_peer (struct CadetPeer *peer)
 Select a random peer that has no incoming channel. More...
 
static void warmup (void)
 Do warmup: create some channels to spread information about the topology. More...
 
static void peer_id_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
 Callback to be called when the requested peer information is available. More...
 
static void tmain (void *cls, struct GNUNET_CADET_TEST_Context *ctx, unsigned int num_peers, struct GNUNET_TESTBED_Peer **testbed_peers, struct GNUNET_CADET_Handle **cadetes)
 test main: start test when all peers are connected More...
 
int main (int argc, char *argv[])
 Main: start profiler. More...
 

Variables

static float rounds [] = { 0.8, 0.6, 0.8, 0.5, 0.3, 0.8, 0.0 }
 Ratio of peers active. More...
 
static struct GNUNET_TIME_Relative round_time
 Duration of each round. More...
 
static struct GNUNET_CONTAINER_MultiPeerMapids
 GNUNET_PeerIdentity -> CadetPeer. More...
 
static struct GNUNET_TESTBED_Peer ** testbed_handles
 Testbed peer handles. More...
 
static struct GNUNET_TESTBED_Operationstats_op
 Testbed Operation (to get stats). More...
 
static struct CadetPeerpeers
 Operation to get peer ids. More...
 
static unsigned int p_ids
 Peer ids counter. More...
 
static unsigned long long peers_total
 Total number of peers. More...
 
static unsigned long long peers_running
 Number of currently running peers. More...
 
static unsigned long long peers_pinging
 Number of peers doing pings. More...
 
static struct GNUNET_CADET_TEST_Contexttest_ctx
 Test context (to shut down). More...
 
static struct GNUNET_SCHEDULER_Taskdisconnect_task
 Task called to disconnect peers, before shutdown. More...
 
static struct GNUNET_SCHEDULER_Tasktest_task
 Task to perform tests. More...
 
static unsigned int current_round
 Round number. More...
 
static int do_warmup
 Do preconnect? (Each peer creates a tunnel to one other peer). More...
 
static unsigned int peers_warmup
 Warmup progress. More...
 
static int test_finished
 Flag to notify callbacks not to generate any new traffic anymore. More...
 
static struct GNUNET_SCHEDULER_Taskround_task
 Task running each round of the benchmark. More...
 
static struct GNUNET_CADET_MessageHandler handlers []
 Handlers, for diverse services. More...
 

Detailed Description

Profiler for cadet experiments.

Definition in file gnunet-cadet-profiler.c.

Macro Definition Documentation

◆ PING

#define PING   1

Definition at line 32 of file gnunet-cadet-profiler.c.

Referenced by tmt_rdy_ping().

◆ PONG

#define PONG   2

Definition at line 33 of file gnunet-cadet-profiler.c.

Referenced by tmt_rdy_pong().

◆ PING_PERIOD

#define PING_PERIOD   500

Paximum ping period in milliseconds.

Real period = rand (0, PING_PERIOD)

Definition at line 39 of file gnunet-cadet-profiler.c.

Referenced by tmt_rdy_ping().

◆ TIMEOUT

How long until we give up on connecting the peers?

Definition at line 44 of file gnunet-cadet-profiler.c.

◆ SHORT_TIME

Time to wait for stuff that should be rather fast.

Definition at line 49 of file gnunet-cadet-profiler.c.

Referenced by tmain().

◆ number_rounds

#define number_rounds   sizeof(rounds) / sizeof(rounds[0])

Total number of rounds.

Definition at line 54 of file gnunet-cadet-profiler.c.

Referenced by show_end_data(), and start_test().

Function Documentation

◆ start_test()

static void start_test ( void *  cls)
static

START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.

Testcase continues when the root receives confirmation of connected peers, on callback funtion ch.

Parameters
clsClosure (unsued).

Definition at line 912 of file gnunet-cadet-profiler.c.

References cadet, CadetPeer::ch, ch, delay_ms_rnd(), CadetPeer::dest, disconnect_cadet_peers(), GC_u2h(), get_index(), GNUNET_CADET_channel_create(), GNUNET_CADET_TEST_cleanup(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_TIME_relative_multiply(), CadetPeer::id, next_rnd(), number_rounds, peers_pinging, peers_running, peers_total, ping(), CadetPeer::ping_task, round_time, and select_random_peer().

Referenced by incoming_channel(), and peer_id_cb().

913 {
914  unsigned long i;
915 
916  test_task = NULL;
917  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Start profiler\n");
918 
919 
920  for (i = 0; i < peers_pinging; i++)
921  {
924  &peers[i].dest->id,
925  GC_u2h(1));
926  if (NULL == peers[i].ch)
927  {
928  GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Channel %lu failed\n", i);
930  return;
931  }
933  "%lu => %u %p\n",
934  i,
935  get_index(peers[i].dest),
936  peers[i].ch);
938  &ping, &peers[i]);
939  }
941  if (NULL != disconnect_task)
945  number_rounds + 1),
947  (void *)__LINE__);
949  &next_rnd,
950  NULL);
951 }
static struct GNUNET_CADET_Handle * cadet
Handle for cadet.
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
static void ping(void *cls)
Send a ping to destination.
void GNUNET_CADET_TEST_cleanup(struct GNUNET_CADET_TEST_Context *ctx)
Clean up the testbed.
static unsigned long long peers_pinging
Number of peers doing pings.
static unsigned int get_index(struct CadetPeer *peer)
Get the index of a peer in the peers array.
struct CadetPeer * dest
Destinaton to ping.
static void next_rnd(void *cls)
Move to next round.
struct GNUNET_SCHEDULER_Task * ping_task
Task to do the next ping.
static struct GNUNET_TIME_Relative round_time
Duration of each round.
const struct GNUNET_HashCode * GC_u2h(uint32_t port)
Transitional function to convert an unsigned int port to a hash value.
static struct GNUNET_SCHEDULER_Task * disconnect_task
Task called to disconnect peers, before shutdown.
static void disconnect_cadet_peers(void *cls)
Disconnect from cadet services af all peers, call shutdown.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:440
static unsigned long long peers_total
Total number of peers.
static unsigned long long peers_running
Number of currently running peers.
static struct GNUNET_CADET_TEST_Context * test_ctx
Test context (to shut down).
static struct GNUNET_SCHEDULER_Task * test_task
Task to perform tests.
struct GNUNET_CADET_Channel * GNUNET_CADET_channel_create(struct GNUNET_CADET_Handle *h, void *channel_cls, const struct GNUNET_PeerIdentity *destination, const struct GNUNET_HashCode *port, GNUNET_CADET_WindowSizeEventHandler window_changes, GNUNET_CADET_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Create a new channel towards a remote peer.
Definition: cadet_api.c:1065
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
struct GNUNET_CADET_Channel * ch
Channel handle for the root peer.
struct GNUNET_PeerIdentity id
Peer ID.
static struct GNUNET_SCHEDULER_Task * round_task
Task running each round of the benchmark.
static struct CadetPeer * select_random_peer(struct CadetPeer *peer)
Select a random peer that has no incoming channel.
#define number_rounds
Total number of rounds.
static struct GNUNET_TIME_Relative delay_ms_rnd(unsigned int max)
Calculate a random delay.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delay_ms_rnd()

static struct GNUNET_TIME_Relative delay_ms_rnd ( unsigned int  max)
static

Calculate a random delay.

Parameters
maxExclusive maximum, in ms.
Returns
A time between 0 a max-1 ms.

Definition at line 267 of file gnunet-cadet-profiler.c.

References GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_TIME_relative_multiply(), and GNUNET_TIME_UNIT_MILLISECONDS.

Referenced by start_test(), and tmt_rdy_ping().

268 {
269  unsigned int rnd;
270 
273 }
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:440
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_index()

static unsigned int get_index ( struct CadetPeer peer)
static

Get the index of a peer in the peers array.

Parameters
peerPeer whose index to get.
Returns
Index of peer in peers.

Definition at line 284 of file gnunet-cadet-profiler.c.

References peers.

Referenced by incoming_channel(), ping(), pong_handler(), start_test(), and warmup().

285 {
286  return peer - peers;
287 }
static struct CadetPeer * peers
Operation to get peer ids.
Here is the caller graph for this function:

◆ show_end_data()

static void show_end_data ( void  )
static

Show the results of the test (banwidth acheived) and log them to GAUGER.

Definition at line 294 of file gnunet-cadet-profiler.c.

References CadetPeer::mean, number_rounds, peer, peers_pinging, CadetPeer::pings, CadetPeer::pongs, and CadetPeer::var.

Referenced by finish_profiler().

295 {
296  struct CadetPeer *peer;
297  unsigned int i;
298  unsigned int j;
299 
300  for (i = 0; i < number_rounds; i++)
301  {
302  for (j = 0; j < peers_pinging; j++)
303  {
304  peer = &peers[j];
305  fprintf(stdout,
306  "ROUND %3u PEER %3u: %10.2f / %10.2f, PINGS: %3u, PONGS: %3u\n",
307  i, j, peer->mean[i], sqrt(peer->var[i] / (peer->pongs[i] - 1)),
308  peer->pings[i], peer->pongs[i]);
309  }
310  }
311 }
Peer description.
static unsigned long long peers_pinging
Number of peers doing pings.
unsigned int pings[sizeof(rounds)/sizeof(rounds[0])]
float mean[sizeof(rounds)/sizeof(rounds[0])]
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
float var[sizeof(rounds)/sizeof(rounds[0])]
static struct CadetPeer * peers
Operation to get peer ids.
unsigned int pongs[sizeof(rounds)/sizeof(rounds[0])]
#define number_rounds
Total number of rounds.
Here is the caller graph for this function:

◆ disconnect_cadet_peers()

static void disconnect_cadet_peers ( void *  cls)
static

Disconnect from cadet services af all peers, call shutdown.

Parameters
clsClosure (unused).

Definition at line 320 of file gnunet-cadet-profiler.c.

References ch, GNUNET_CADET_channel_destroy(), GNUNET_CADET_TEST_cleanup(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_operation_done(), GNUNET_YES, CadetPeer::incoming_ch, line, op, peers_total, CadetPeer::up, and CadetPeer::warmup_ch.

Referenced by abort_test(), shutdown_task(), start_test(), stats_cont(), and tmain().

321 {
322  long line = (long)cls;
323  unsigned int i;
324 
326  "disconnecting cadet service, called from line %ld\n",
327  line);
328  disconnect_task = NULL;
329  for (i = 0; i < peers_total; i++)
330  {
331  if (NULL != peers[i].op)
333 
334  if (peers[i].up != GNUNET_YES)
335  continue;
336 
337  if (NULL != peers[i].ch)
338  {
340  "%u: channel %p\n", i, peers[i].ch);
342  }
343  if (NULL != peers[i].warmup_ch)
344  {
346  "%u: warmup channel %p\n",
347  i, peers[i].warmup_ch);
348  GNUNET_CADET_channel_destroy(peers[i].warmup_ch);
349  }
350  if (NULL != peers[i].incoming_ch)
351  {
353  "%u: incoming channel %p\n",
354  i, peers[i].incoming_ch);
355  GNUNET_CADET_channel_destroy(peers[i].incoming_ch);
356  }
357  }
360 }
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
void GNUNET_CADET_TEST_cleanup(struct GNUNET_CADET_TEST_Context *ctx)
Clean up the testbed.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
static struct GNUNET_SCHEDULER_Task * disconnect_task
Task called to disconnect peers, before shutdown.
static char * line
Desired phone line (string to be converted to a hash).
static unsigned long long peers_total
Total number of peers.
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2037
static struct GNUNET_CADET_TEST_Context * test_ctx
Test context (to shut down).
struct GNUNET_CADET_Channel * warmup_ch
Channel handle for a warmup channel.
struct GNUNET_CADET_Channel * incoming_ch
Channel handle for the dest peer.
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
int up
Is peer up?
#define GNUNET_YES
Definition: gnunet_common.h:77
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:139
void GNUNET_CADET_channel_destroy(struct GNUNET_CADET_Channel *channel)
Destroy an existing channel.
Definition: cadet_api.c:900
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Shut down peergroup, clean up.

Parameters
clsClosure (unused).

Definition at line 369 of file gnunet-cadet-profiler.c.

References disconnect_cadet_peers(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_now(), and GNUNET_SCHEDULER_cancel().

Referenced by tmain().

370 {
372  "Ending test.\n");
373  if (NULL != disconnect_task)
374  {
377  (void *)__LINE__);
378  }
379  if (NULL != round_task)
380  {
382  round_task = NULL;
383  }
384  if (NULL != test_task)
385  {
387  test_task = NULL;
388  }
389 }
static struct GNUNET_SCHEDULER_Task * disconnect_task
Task called to disconnect peers, before shutdown.
static void disconnect_cadet_peers(void *cls)
Disconnect from cadet services af all peers, call shutdown.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1264
static struct GNUNET_SCHEDULER_Task * test_task
Task to perform tests.
#define GNUNET_log(kind,...)
static struct GNUNET_SCHEDULER_Task * round_task
Task running each round of the benchmark.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956
Here is the call graph for this function:
Here is the caller graph for this function:

◆ abort_test()

static void abort_test ( long  line)
static

Finish test normally: schedule disconnect and shutdown.

Parameters
lineLine in the code the abort is requested from (LINE).

Definition at line 398 of file gnunet-cadet-profiler.c.

References disconnect_cadet_peers(), GNUNET_SCHEDULER_add_now(), and GNUNET_SCHEDULER_cancel().

Referenced by peer_id_cb().

399 {
400  if (disconnect_task != NULL)
401  {
404  (void *)line);
405  }
406 }
static struct GNUNET_SCHEDULER_Task * disconnect_task
Task called to disconnect peers, before shutdown.
static void disconnect_cadet_peers(void *cls)
Disconnect from cadet services af all peers, call shutdown.
static char * line
Desired phone line (string to be converted to a hash).
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1264
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_cont()

static void stats_cont ( void *  cls,
struct GNUNET_TESTBED_Operation op,
const char *  emsg 
)
static

Stats callback.

Finish the stats testbed operation and when all stats have been iterated, shutdown the test.

Parameters
clsclosure
opthe operation that has been finished
emsgerror message in case the operation has failed; will be NULL if operation has executed successfully.

Definition at line 418 of file gnunet-cadet-profiler.c.

References disconnect_cadet_peers(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), and GNUNET_TESTBED_operation_done().

Referenced by collect_stats().

419 {
420  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "... collecting statistics done.\n");
422 
423  if (NULL != disconnect_task)
426  (void *)__LINE__);
427 }
static struct GNUNET_TESTBED_Operation * stats_op
Testbed Operation (to get stats).
static struct GNUNET_SCHEDULER_Task * disconnect_task
Task called to disconnect peers, before shutdown.
static void disconnect_cadet_peers(void *cls)
Disconnect from cadet services af all peers, call shutdown.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1264
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2037
#define GNUNET_log(kind,...)
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_iterator()

static int stats_iterator ( void *  cls,
const struct GNUNET_TESTBED_Peer peer,
const char *  subsystem,
const char *  name,
uint64_t  value,
int  is_persistent 
)
static

Process statistic values.

Parameters
clsclosure
peerthe peer the statistic belong to
subsystemname of subsystem that created the statistic
namethe name of the datum
valuethe current value
is_persistentGNUNET_YES if the value is persistent, GNUNET_NO if not
Returns
GNUNET_OK to continue, GNUNET_SYSERR to abort iteration

Definition at line 442 of file gnunet-cadet-profiler.c.

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, and GNUNET_TESTBED_get_index().

Referenced by collect_stats().

448 {
449  uint32_t i;
450 
451  i = GNUNET_TESTBED_get_index(peer);
453  " STATS %u - %s [%s]: %llu\n",
454  i, subsystem, name,
455  (unsigned long long)value);
456 
457  return GNUNET_OK;
458 }
static char * subsystem
Set to subsystem that we&#39;re going to get stats for (or NULL for all).
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
static char * value
Value of the record to add/remove.
const char * name
uint32_t GNUNET_TESTBED_get_index(const struct GNUNET_TESTBED_Peer *peer)
Return the index of the peer inside of the total peer array, aka.
Definition: testbed_api.c:2314
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ collect_stats()

static void collect_stats ( void *  cls)
static

Task check that keepalives were sent and received.

Parameters
clsClosure (NULL).

Definition at line 467 of file gnunet-cadet-profiler.c.

References GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_TESTBED_get_statistics(), peers_total, stats_cont(), and stats_iterator().

Referenced by finish_profiler().

468 {
470  "Start collecting statistics...\n");
473  NULL, NULL,
475  &stats_cont, NULL);
476 }
static struct GNUNET_TESTBED_Operation * stats_op
Testbed Operation (to get stats).
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_get_statistics(unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, const char *subsystem, const char *name, GNUNET_TESTBED_StatisticsIterator proc, GNUNET_TESTBED_OperationCompletionCallback cont, void *cls)
Convenience method that iterates over all (running) peers and retrieves all statistics from each peer...
static struct GNUNET_TESTBED_Peer ** testbed_handles
Testbed peer handles.
static int stats_iterator(void *cls, const struct GNUNET_TESTBED_Peer *peer, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Process statistic values.
static unsigned long long peers_total
Total number of peers.
static void stats_cont(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Stats callback.
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ finish_profiler()

static void finish_profiler ( void *  cls)
static

Finish profiler normally.

Signal finish and start collecting stats.

Parameters
clsClosure (unused).

Definition at line 485 of file gnunet-cadet-profiler.c.

References collect_stats(), GNUNET_SCHEDULER_add_now(), GNUNET_YES, show_end_data(), and test_finished.

Referenced by next_rnd().

486 {
488  show_end_data();
490 }
static int test_finished
Flag to notify callbacks not to generate any new traffic anymore.
static void collect_stats(void *cls)
Task check that keepalives were sent and received.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1264
static void show_end_data(void)
Show the results of the test (banwidth acheived) and log them to GAUGER.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ adjust_running_peers()

static void adjust_running_peers ( unsigned int  target)
static

Set the total number of running peers.

Parameters
targetDesired number of running peers.

Definition at line 499 of file gnunet-cadet-profiler.c.

References CadetPeer::ch, ch, delta, CadetPeer::dest, GNUNET_assert, GNUNET_break, GNUNET_CADET_channel_destroy(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_TESTBED_peer_manage_service(), GNUNET_YES, CadetPeer::incoming_ch, op, peers_pinging, peers_running, peers_total, CadetPeer::ping_ntr, CadetPeer::ping_task, run(), and CadetPeer::up.

Referenced by next_rnd().

500 {
502  unsigned int delta;
503  unsigned int run;
504  unsigned int i;
505  unsigned int r;
506 
507  GNUNET_assert(target <= peers_total);
508 
509  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "adjust peers to %u\n", target);
510  if (target > peers_running)
511  {
512  delta = target - peers_running;
513  run = GNUNET_YES;
514  }
515  else
516  {
517  delta = peers_running - target;
518  run = GNUNET_NO;
519  }
520 
521  for (i = 0; i < delta; i++)
522  {
523  do
524  {
527  r += peers_pinging;
528  }
529  while (peers[r].up == run || NULL != peers[r].incoming);
530  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "St%s peer %u: %s\n",
531  run ? "arting" : "opping", r, GNUNET_i2s(&peers[r].id));
532 
533  if (NULL != peers[r].ping_task)
534  {
535  GNUNET_SCHEDULER_cancel(peers[r].ping_task);
536  peers[r].ping_task = NULL;
537  }
538  if (NULL != peers[r].ping_ntr)
539  {
540  GNUNET_CADET_notify_transmit_ready_cancel(peers[r].ping_ntr);
541  peers[r].ping_ntr = NULL;
542  }
543  peers[r].up = run;
544 
545  if (NULL != peers[r].ch)
547  peers[r].ch = NULL;
548  if (NULL != peers[r].dest)
549  {
550  if (NULL != peers[r].dest->incoming_ch)
552  peers[r].dest->incoming_ch = NULL;
553  }
554 
556  "cadet", NULL, NULL, run);
557  GNUNET_break(NULL != op);
558  peers_running += run ? 1 : -1;
560  }
561 }
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run by the scheduler.
Definition: gnunet-arm.c:720
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
static unsigned long long peers_pinging
Number of peers doing pings.
static struct GNUNET_TESTBED_Peer ** testbed_handles
Testbed peer handles.
struct CadetPeer * dest
Destinaton to ping.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_SCHEDULER_Task * ping_task
Task to do the next ping.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Opaque handle to an abstract operation to be executed by the testing framework.
struct GNUNET_CADET_TransmitHandle * ping_ntr
NTR operation for the next ping.
static unsigned long long peers_total
Total number of peers.
static unsigned long long peers_running
Number of currently running peers.
struct GNUNET_CADET_Channel * incoming_ch
Channel handle for the dest peer.
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
struct GNUNET_CADET_Channel * ch
Channel handle for the root peer.
int up
Is peer up?
#define GNUNET_YES
Definition: gnunet_common.h:77
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:139
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_manage_service(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls, unsigned int start)
Start or stop given service at a peer.
void GNUNET_CADET_channel_destroy(struct GNUNET_CADET_Channel *channel)
Destroy an existing channel.
Definition: cadet_api.c:900
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956
Here is the call graph for this function:
Here is the caller graph for this function:

◆ next_rnd()

static void next_rnd ( void *  cls)
static

Move to next round.

Parameters
clsClosure (round #).

Definition at line 570 of file gnunet-cadet-profiler.c.

References adjust_running_peers(), buf, current_round, finish_profiler(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_now(), peers_total, round_time, rounds, size, and tmt_rdy_ping().

Referenced by start_test().

571 {
573  "ROUND %u\n",
574  current_round);
575  if (0.0 == rounds[current_round])
576  {
577  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Finishing\n");
579  return;
580  }
581  adjust_running_peers(rounds[current_round] * peers_total);
582  current_round++;
583 
585  &next_rnd,
586  NULL);
587 }
static void adjust_running_peers(unsigned int target)
Set the total number of running peers.
static void next_rnd(void *cls)
Move to next round.
static struct GNUNET_TIME_Relative round_time
Duration of each round.
static void finish_profiler(void *cls)
Finish profiler normally.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1264
static unsigned long long peers_total
Total number of peers.
static unsigned int current_round
Round number.
#define GNUNET_log(kind,...)
static struct GNUNET_SCHEDULER_Task * round_task
Task running each round of the benchmark.
static float rounds[]
Ratio of peers active.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tmt_rdy_ping()

static size_t tmt_rdy_ping ( void *  cls,
size_t  size,
void *  buf 
)
static

Transmit ping callback.

Parameters
clsClosure (peer for PING, NULL for PONG).
sizeSize of the tranmist buffer.
bufPointer to the beginning of the buffer.
Returns
Number of bytes written to buf.
Parameters
clsClosure (peer).
sizeSize of the buffer we have.
bufBuffer to copy data to.

Definition at line 683 of file gnunet-cadet-profiler.c.

References buf, CadetPingMessage::counter, current_round, CadetPeer::data_received, CadetPeer::data_sent, delay_ms_rnd(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_hton(), GNUNET_YES, CadetPingMessage::header, msg, peer, PING, ping(), CadetPeer::ping_ntr, PING_PERIOD, CadetPeer::ping_task, CadetPeer::pings, CadetPingMessage::round_number, GNUNET_MessageHeader::size, test_finished, CadetPingMessage::timestamp, and GNUNET_MessageHeader::type.

Referenced by next_rnd(), and ping().

684 {
685  struct CadetPeer *peer = cls;
686  struct CadetPingMessage *msg = buf;
687 
688  peer->ping_ntr = NULL;
690  "tmt_rdy called, filling buffer\n");
691  if (size < sizeof(struct CadetPingMessage) || NULL == buf)
692  {
695  "size %u, buf %p, data_sent %u, data_received %u\n",
696  (unsigned int)size,
697  buf,
698  peer->data_sent,
699  peer->data_received);
700 
701  return 0;
702  }
704  "Sending: msg %d\n",
705  peer->data_sent);
706  msg->header.size = htons(size);
707  msg->header.type = htons(PING);
708  msg->counter = htonl(peer->data_sent++);
709  msg->round_number = htonl(current_round);
711  peer->pings[current_round]++;
713  &ping, peer);
714 
715  return sizeof(struct CadetPingMessage);
716 }
Peer description.
static void ping(void *cls)
Send a ping to destination.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static int test_finished
Flag to notify callbacks not to generate any new traffic anymore.
struct GNUNET_SCHEDULER_Task * ping_task
Task to do the next ping.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_CADET_TransmitHandle * ping_ntr
NTR operation for the next ping.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
unsigned int pings[sizeof(rounds)/sizeof(rounds[0])]
uint32_t round_number
Round number.
struct GNUNET_TIME_AbsoluteNBO timestamp
Time the message was sent.
static char buf[2048]
int data_sent
Number of payload packes sent.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static unsigned int size
Size of the "table".
Definition: peer.c:66
uint32_t counter
Message number.
#define PING_PERIOD
Paximum ping period in milliseconds.
static unsigned int current_round
Round number.
Message type for pings.
int data_received
Number of payload packets received.
#define GNUNET_log(kind,...)
struct GNUNET_MessageHeader header
Header.
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
Definition: time.c:655
#define PING
static struct GNUNET_TIME_Relative delay_ms_rnd(unsigned int max)
Calculate a random delay.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tmt_rdy_pong()

static size_t tmt_rdy_pong ( void *  cls,
size_t  size,
void *  buf 
)
static

Transmit pong callback.

Parameters
clsClosure (copy of PING message, to be freed).
sizeSize of the buffer we have.
bufBuffer to copy data to.

Definition at line 611 of file gnunet-cadet-profiler.c.

References GNUNET_free, GNUNET_memcpy, CadetPingMessage::header, ping(), PONG, pong(), and GNUNET_MessageHeader::type.

Referenced by pong().

612 {
613  struct CadetPingMessage *ping = cls;
614  struct CadetPingMessage *pong;
615 
616  if (0 == size || NULL == buf)
617  {
618  GNUNET_free(ping);
619  return 0;
620  }
621  pong = (struct CadetPingMessage *)buf;
622  GNUNET_memcpy(pong, ping, sizeof(*ping));
623  pong->header.type = htons(PONG);
624 
625  GNUNET_free(ping);
626  return sizeof(*ping);
627 }
static void ping(void *cls)
Send a ping to destination.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
static char buf[2048]
static void pong(struct GNUNET_CADET_Channel *channel, const struct CadetPingMessage *ping)
Reply with a pong to origin.
static unsigned int size
Size of the "table".
Definition: peer.c:66
#define PONG
Message type for pings.
struct GNUNET_MessageHeader header
Header.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ping()

static void ping ( void *  cls)
static

Send a ping to destination.

Parameters
clsClosure (peer).

Definition at line 636 of file gnunet-cadet-profiler.c.

References CadetPeer::ch, CadetPeer::data_sent, CadetPeer::dest, get_index(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, peer, CadetPeer::ping_ntr, CadetPeer::ping_task, test_finished, and tmt_rdy_ping().

Referenced by core_connect_adapter(), GSC_KX_init(), GST_validation_handle_ping(), pong(), start_test(), tmt_rdy_ping(), tmt_rdy_pong(), and transport_connect_adapter().

637 {
638  struct CadetPeer *peer = cls;
639 
640  peer->ping_task = NULL;
641  if (GNUNET_YES == test_finished)
642  return;
644  "%u -> %u (%u)\n",
645  get_index(peer),
646  get_index(peer->dest),
647  peer->data_sent);
648  peer->ping_ntr = GNUNET_CADET_notify_transmit_ready(peer->ch, GNUNET_NO,
650  sizeof(struct CadetPingMessage),
651  &tmt_rdy_ping, peer);
652 }
Peer description.
static unsigned int get_index(struct CadetPeer *peer)
Get the index of a peer in the peers array.
struct CadetPeer * dest
Destinaton to ping.
static int test_finished
Flag to notify callbacks not to generate any new traffic anymore.
struct GNUNET_SCHEDULER_Task * ping_task
Task to do the next ping.
#define GNUNET_NO
Definition: gnunet_common.h:78
static size_t tmt_rdy_ping(void *cls, size_t size, void *buf)
Transmit ping callback.
struct GNUNET_CADET_TransmitHandle * ping_ntr
NTR operation for the next ping.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
int data_sent
Number of payload packes sent.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
Message type for pings.
#define GNUNET_log(kind,...)
struct GNUNET_CADET_Channel * ch
Channel handle for the root peer.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pong()

static void pong ( struct GNUNET_CADET_Channel channel,
const struct CadetPingMessage ping 
)
static

Reply with a pong to origin.

Parameters
clsClosure (peer).
tcTask context.

Definition at line 661 of file gnunet-cadet-profiler.c.

References GNUNET_new, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, ping(), and tmt_rdy_pong().

Referenced by core_connect_adapter(), GSC_KX_init(), GST_validation_handle_ping(), GST_validation_handle_pong(), multicast_pong(), ping_handler(), tmt_rdy_pong(), and transport_connect_adapter().

663 {
664  struct CadetPingMessage *copy;
665 
666  copy = GNUNET_new(struct CadetPingMessage);
667  *copy = *ping;
668  GNUNET_CADET_notify_transmit_ready(channel, GNUNET_NO,
670  sizeof(struct CadetPingMessage),
671  &tmt_rdy_pong, copy);
672 }
static void ping(void *cls)
Send a ping to destination.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static size_t tmt_rdy_pong(void *cls, size_t size, void *buf)
Transmit pong callback.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
Message type for pings.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ping_handler()

int ping_handler ( void *  cls,
struct GNUNET_CADET_Channel channel,
void **  channel_ctx,
const struct GNUNET_MessageHeader message 
)

Function is called whenever a PING message is received.

Parameters
clsclosure (peer #, set from GNUNET_CADET_connect)
channelconnection to the other end
channel_ctxplace to store local state associated with the channel
messagethe actual message
Returns
GNUNET_OK to keep the connection open, GNUNET_SYSERR to close it (signal serious error)

Definition at line 730 of file gnunet-cadet-profiler.c.

References GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_OK, pong(), and test_finished.

733 {
734  long n = (long)cls;
735 
737  "%u got PING\n",
738  (unsigned int)n);
739  GNUNET_CADET_receive_done(channel);
740  if (GNUNET_NO == test_finished)
741  pong(channel, (struct CadetPingMessage *)message);
742 
743  return GNUNET_OK;
744 }
static int test_finished
Flag to notify callbacks not to generate any new traffic anymore.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
static void pong(struct GNUNET_CADET_Channel *channel, const struct CadetPingMessage *ping)
Reply with a pong to origin.
void GNUNET_CADET_receive_done(struct GNUNET_CADET_Channel *channel)
Send an ack on the channel to confirm the processing of a message.
Definition: cadet_api.c:951
Message type for pings.
#define GNUNET_log(kind,...)
Here is the call graph for this function:

◆ pong_handler()

int pong_handler ( void *  cls,
struct GNUNET_CADET_Channel channel,
void **  channel_ctx,
const struct GNUNET_MessageHeader message 
)

Function is called whenever a PONG message is received.

Parameters
clsclosure (peer #, set from GNUNET_CADET_connect)
channelconnection to the other end
channel_ctxplace to store local state associated with the channel
messagethe actual message
Returns
GNUNET_OK to keep the connection open, GNUNET_SYSERR to close it (signal serious error)

Definition at line 758 of file gnunet-cadet-profiler.c.

References CadetPingMessage::counter, delta, CadetPeer::dest, get_index(), GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_absolute_ntoh(), CadetPeer::mean, msg, peer, CadetPeer::pongs, GNUNET_TIME_Relative::rel_value_us, CadetPingMessage::round_number, CadetPingMessage::timestamp, and CadetPeer::var.

761 {
762  long n = (long)cls;
763  struct CadetPeer *peer;
764  struct CadetPingMessage *msg;
765  struct GNUNET_TIME_Absolute send_time;
766  struct GNUNET_TIME_Relative latency;
767  unsigned int r /* Ping round */;
768  float delta;
769 
770  GNUNET_CADET_receive_done(channel);
771  peer = &peers[n];
772 
773  msg = (struct CadetPingMessage *)message;
774 
775  send_time = GNUNET_TIME_absolute_ntoh(msg->timestamp);
776  latency = GNUNET_TIME_absolute_get_duration(send_time);
777  r = ntohl(msg->round_number);
778  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "%u <- %u (%u) latency: %s\n",
779  get_index(peer),
780  get_index(peer->dest),
781  (uint32_t)ntohl(msg->counter),
783 
784  /* Online variance calculation */
785  peer->pongs[r]++;
786  delta = latency.rel_value_us - peer->mean[r];
787  peer->mean[r] = peer->mean[r] + delta / peer->pongs[r];
788  peer->var[r] += delta * (latency.rel_value_us - peer->mean[r]);
789 
790  return GNUNET_OK;
791 }
Peer description.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
Definition: time.c:671
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
static unsigned int get_index(struct CadetPeer *peer)
Get the index of a peer in the peers array.
struct CadetPeer * dest
Destinaton to ping.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
uint32_t round_number
Round number.
struct GNUNET_TIME_AbsoluteNBO timestamp
Time the message was sent.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:686
float mean[sizeof(rounds)/sizeof(rounds[0])]
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
float var[sizeof(rounds)/sizeof(rounds[0])]
uint32_t counter
Message number.
void GNUNET_CADET_receive_done(struct GNUNET_CADET_Channel *channel)
Send an ack on the channel to confirm the processing of a message.
Definition: cadet_api.c:951
Message type for pings.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition: time.c:373
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
Time for absolute times used by GNUnet, in microseconds.
unsigned int pongs[sizeof(rounds)/sizeof(rounds[0])]
Time for relative time used by GNUnet, in microseconds.
Here is the call graph for this function:

◆ incoming_channel()

static void* incoming_channel ( void *  cls,
struct GNUNET_CADET_Channel channel,
const struct GNUNET_PeerIdentity initiator,
const struct GNUNET_HashCode port,
enum GNUNET_CADET_ChannelOption  options 
)
static

Method called whenever another peer has added us to a channel the other peer initiated.

Parameters
clsClosure.
channelNew handle to the channel.
initiatorPeer that started the channel.
portPort this channel is connected to.
optionschannel option flags
Returns
Initial channel context for the channel (can be NULL – that's not an error).

Definition at line 817 of file gnunet-cadet-profiler.c.

References CadetPeer::dest, get_index(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_TIME_UNIT_SECONDS, CadetPeer::incoming, CadetPeer::incoming_ch, peer, peers_total, peers_warmup, and start_test().

Referenced by main().

821 {
822  long n = (long)cls;
823  struct CadetPeer *peer;
824 
825  peer = GNUNET_CONTAINER_multipeermap_get(ids, initiator);
826  GNUNET_assert(NULL != peer);
827  if (NULL == peers[n].incoming)
828  {
830  "WARMUP %3u: %u <= %u\n",
831  peers_warmup,
832  (unsigned int)n,
833  get_index(peer));
834  peers_warmup++;
836  return NULL;
837  if (NULL != test_task)
838  {
841  &start_test, NULL);
842  }
843  return NULL;
844  }
845  GNUNET_assert(peer == peers[n].incoming);
846  GNUNET_assert(peer->dest == &peers[n]);
848  "%u <= %u %p\n",
849  (unsigned int)n,
850  get_index(peer),
851  channel);
852  peers[n].incoming_ch = channel;
853 
854  return NULL;
855 }
Peer description.
struct CadetPeer * incoming
Incoming channel for pings.
static unsigned int get_index(struct CadetPeer *peer)
Get the index of a peer in the peers array.
struct CadetPeer * dest
Destinaton to ping.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
static struct GNUNET_CONTAINER_MultiPeerMap * ids
GNUNET_PeerIdentity -> CadetPeer.
static unsigned int peers_warmup
Warmup progress.
static unsigned long long peers_total
Total number of peers.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_CADET_Channel * incoming_ch
Channel handle for the dest peer.
static struct GNUNET_SCHEDULER_Task * test_task
Task to perform tests.
static struct CadetPeer * peers
Operation to get peer ids.
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
#define GNUNET_log(kind,...)
static void start_test(void *cls)
START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956
Here is the call graph for this function:
Here is the caller graph for this function:

◆ channel_cleaner()

static void channel_cleaner ( void *  cls,
const struct GNUNET_CADET_Channel channel,
void *  channel_ctx 
)
static

Function called whenever an inbound channel is destroyed.

Should clean up any associated state.

Parameters
clsclosure (set from GNUNET_CADET_connect)
channelconnection to the other end (henceforth invalid)
channel_ctxplace where local state associated with the channel is stored

Definition at line 867 of file gnunet-cadet-profiler.c.

References CadetPeer::ch, GNUNET_ERROR_TYPE_INFO, GNUNET_log, and peer.

Referenced by main().

870 {
871  long n = (long)cls;
872  struct CadetPeer *peer = &peers[n];
873 
875  "Channel %p disconnected at peer %ld\n", channel, n);
876  if (peer->ch == channel)
877  peer->ch = NULL;
878 }
Peer description.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
struct GNUNET_CADET_Channel * ch
Channel handle for the root peer.
Here is the caller graph for this function:

◆ select_random_peer()

static struct CadetPeer* select_random_peer ( struct CadetPeer peer)
static

Select a random peer that has no incoming channel.

Parameters
peerID of the peer connecting. NULL if irrelevant (warmup).
Returns
Random peer not yet connected to.

Definition at line 889 of file gnunet-cadet-profiler.c.

References GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), CadetPeer::incoming, peer, and peers_total.

Referenced by start_test(), and warmup().

890 {
891  unsigned int r;
892 
893  do
894  {
896  }
897  while (NULL != peers[r].incoming);
898  peers[r].incoming = peer;
899 
900  return &peers[r];
901 }
struct CadetPeer * incoming
Incoming channel for pings.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
static unsigned long long peers_total
Total number of peers.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static struct CadetPeer * peers
Operation to get peer ids.
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ warmup()

static void warmup ( void  )
static

Do warmup: create some channels to spread information about the topology.

Definition at line 958 of file gnunet-cadet-profiler.c.

References cadet, GC_u2h(), get_index(), GNUNET_CADET_channel_create(), GNUNET_CADET_TEST_cleanup(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, CadetPeer::id, peer, peers_total, select_random_peer(), and CadetPeer::warmup_ch.

Referenced by peer_id_cb().

959 {
960  struct CadetPeer *peer;
961  unsigned int i;
962 
963  for (i = 0; i < peers_total; i++)
964  {
965  peer = select_random_peer(NULL);
966  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "WARMUP %u => %u\n",
967  i, get_index(peer));
968  peers[i].warmup_ch =
969  GNUNET_CADET_channel_create(peers[i].cadet, NULL, &peer->id,
970  GC_u2h(1));
971  if (NULL == peers[i].warmup_ch)
972  {
973  GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Warmup %u failed\n", i);
975  return;
976  }
977  }
978 }
static struct GNUNET_CADET_Handle * cadet
Handle for cadet.
Peer description.
void GNUNET_CADET_TEST_cleanup(struct GNUNET_CADET_TEST_Context *ctx)
Clean up the testbed.
static unsigned int get_index(struct CadetPeer *peer)
Get the index of a peer in the peers array.
const struct GNUNET_HashCode * GC_u2h(uint32_t port)
Transitional function to convert an unsigned int port to a hash value.
static unsigned long long peers_total
Total number of peers.
static struct GNUNET_CADET_TEST_Context * test_ctx
Test context (to shut down).
struct GNUNET_CADET_Channel * warmup_ch
Channel handle for a warmup channel.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_CADET_Channel * GNUNET_CADET_channel_create(struct GNUNET_CADET_Handle *h, void *channel_cls, const struct GNUNET_PeerIdentity *destination, const struct GNUNET_HashCode *port, GNUNET_CADET_WindowSizeEventHandler window_changes, GNUNET_CADET_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Create a new channel towards a remote peer.
Definition: cadet_api.c:1065
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
struct GNUNET_PeerIdentity id
Peer ID.
static struct CadetPeer * select_random_peer(struct CadetPeer *peer)
Select a random peer that has no incoming channel.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_id_cb()

static void peer_id_cb ( void *  cls,
struct GNUNET_TESTBED_Operation op,
const struct GNUNET_TESTBED_PeerInformation pinfo,
const char *  emsg 
)
static

Callback to be called when the requested peer information is available.

Parameters
clsthe closure from GNUNET_TESTBED_peer_get_information()
opthe operation this callback corresponds to
pinfothe result; will be NULL if the operation has failed
emsgerror message if the operation has failed; NULL if the operation is successfull

Definition at line 991 of file gnunet-cadet-profiler.c.

References abort_test(), do_warmup, GNUNET_break, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_TESTBED_operation_done(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_TIME_UNIT_SECONDS, CadetPeer::id, GNUNET_TESTBED_PeerInformation::id, CadetPeer::op, p_ids, peers_total, GNUNET_TESTBED_PeerInformation::result, start_test(), and warmup().

Referenced by tmain().

995 {
996  long n = (long)cls;
997 
998  if (NULL == pinfo || NULL != emsg)
999  {
1000  GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "pi_cb: %s\n", emsg);
1001  abort_test(__LINE__);
1002  return;
1003  }
1004  peers[n].id = *(pinfo->result.id);
1006  "%ld id: %s\n",
1007  n,
1008  GNUNET_i2s(&peers[n].id));
1012 
1014  peers[n].op = NULL;
1015 
1016  p_ids++;
1017  if (p_ids < peers_total)
1018  return;
1019  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Got all IDs, starting profiler\n");
1020  if (do_warmup)
1021  {
1022  struct GNUNET_TIME_Relative delay;
1023 
1024  warmup();
1026  100 * peers_total);
1028  return; /* start_test from incoming_channel */
1029  }
1030  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Starting in a second...\n");
1032  &start_test, NULL);
1033 }
static void abort_test(long line)
Finish test normally: schedule disconnect and shutdown.
union GNUNET_TESTBED_PeerInformation::@64 result
The result of the get information operation; Choose according to the pit.
static unsigned int p_ids
Peer ids counter.
static int do_warmup
Do preconnect? (Each peer creates a tunnel to one other peer).
#define GNUNET_TIME_UNIT_SECONDS
One second.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_PeerIdentity * id
The identity of the peer.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
, &#39; bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_...
static struct GNUNET_CONTAINER_MultiPeerMap * ids
GNUNET_PeerIdentity -> CadetPeer.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:440
static unsigned long long peers_total
Total number of peers.
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2037
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
static struct GNUNET_SCHEDULER_Task * test_task
Task to perform tests.
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
struct GNUNET_PeerIdentity id
Peer ID.
static void start_test(void *cls)
START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
struct GNUNET_TESTBED_Operation * op
Testbed Operation (to get peer id, etc).
static void warmup(void)
Do warmup: create some channels to spread information about the topology.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
Time for relative time used by GNUnet, in microseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tmain()

static void tmain ( void *  cls,
struct GNUNET_CADET_TEST_Context ctx,
unsigned int  num_peers,
struct GNUNET_TESTBED_Peer **  testbed_peers,
struct GNUNET_CADET_Handle **  cadetes 
)
static

test main: start test when all peers are connected

Parameters
clsClosure.
ctxArgument to give to GNUNET_CADET_TEST_cleanup on test end.
num_peersNumber of peers that are running.
testbed_peersArray of peers.
cadetesHandle to each of the CADETs of the peers.

Definition at line 1046 of file gnunet-cadet-profiler.c.

References CadetPeer::cadet, ctx, disconnect_cadet_peers(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_PIT_IDENTITY, GNUNET_YES, num_peers, CadetPeer::op, peer_id_cb(), peers_running, peers_total, SHORT_TIME, shutdown_task(), testbed_peers, and CadetPeer::up.

Referenced by GNUNET_CADET_TEST_ruN(), GNUNET_DHT_TEST_run(), and main().

1051 {
1052  unsigned long i;
1053 
1055  "test main\n");
1056  test_ctx = ctx;
1062  (void *)__LINE__);
1064  for (i = 0; i < peers_total; i++)
1065  {
1067  "requesting id %ld\n",
1068  i);
1069  peers[i].up = GNUNET_YES;
1070  peers[i].cadet = cadetes[i];
1071  peers[i].op =
1074  &peer_id_cb, (void *)i);
1075  }
1076  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "requested peer ids\n");
1077  /* Continues from pi_cb -> do_test */
1078 }
static struct GNUNET_TESTBED_Peer ** testbed_handles
Testbed peer handles.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1284
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
static struct GNUNET_SCHEDULER_Task * disconnect_task
Task called to disconnect peers, before shutdown.
static void disconnect_cadet_peers(void *cls)
Disconnect from cadet services af all peers, call shutdown.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
static unsigned long long peers_total
Total number of peers.
static unsigned long long peers_running
Number of currently running peers.
static struct GNUNET_CADET_TEST_Context * test_ctx
Test context (to shut down).
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_get_information(struct GNUNET_TESTBED_Peer *peer, enum GNUNET_TESTBED_PeerInformationType pit, GNUNET_TESTBED_PeerInfoCallback cb, void *cb_cls)
Request information about a peer.
static struct GNUNET_TESTBED_Peer ** testbed_peers
Handles to all of the running peers.
struct GNUNET_CADET_Handle * cadet
Cadet handle for the root peer.
static unsigned int num_peers
What is the identity of the peer? Returns a &#39;const struct GNUNET_PeerIdentity *&#39;. ...
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
int up
Is peer up?
#define GNUNET_YES
Definition: gnunet_common.h:77
static void peer_id_cb(void *cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
Callback to be called when the requested peer information is available.
static void shutdown_task(void *cls)
Shut down peergroup, clean up.
struct GNUNET_TESTBED_Operation * op
Testbed Operation (to get peer id, etc).
#define SHORT_TIME
Time to wait for stuff that should be rather fast.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Main: start profiler.

Definition at line 1085 of file gnunet-cadet-profiler.c.

References atoll(), channel_cleaner(), config_file, do_warmup, GC_u2h(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_create(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new_array, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_YES, handlers, incoming_channel(), p_ids, peers_pinging, peers_total, round_time, test_finished, and tmain().

1086 {
1087  static const struct GNUNET_HashCode *ports[2];
1088  const char *config_file;
1089 
1090  config_file = ".profiler.conf";
1091 
1092  if (4 > argc)
1093  {
1094  fprintf(stderr,
1095  "usage: %s ROUND_TIME PEERS PINGS [DO_WARMUP]\n",
1096  argv[0]);
1097  fprintf(stderr,
1098  "example: %s 30s 16 1 Y\n",
1099  argv[0]);
1100  return 1;
1101  }
1102 
1103  if (GNUNET_OK !=
1105  &round_time))
1106  {
1107  fprintf(stderr,
1108  "%s is not a valid time\n",
1109  argv[1]);
1110  return 1;
1111  }
1112 
1113  peers_total = atoll(argv[2]);
1114  if (2 > peers_total)
1115  {
1116  fprintf(stderr,
1117  "%s peers is not valid (> 2)\n",
1118  argv[1]);
1119  return 1;
1120  }
1122  struct CadetPeer);
1123  peers_pinging = atoll(argv[3]);
1124 
1125  if (peers_total < 2 * peers_pinging)
1126  {
1128  "not enough peers, total should be > 2 * peers_pinging\n");
1129  return 1;
1130  }
1131 
1132  do_warmup = (5 > argc || argv[4][0] != 'N');
1133 
1135  GNUNET_YES);
1136  GNUNET_assert(NULL != ids);
1137  p_ids = 0;
1139  ports[0] = GC_u2h(1);
1140  ports[1] = 0;
1141  GNUNET_CADET_TEST_run("cadet-profiler", config_file, peers_total,
1142  &tmain, NULL, /* tmain cls */
1144  handlers, ports);
1145  GNUNET_free(peers);
1146 
1147  return 0;
1148 }
Peer description.
static unsigned long long peers_pinging
Number of peers doing pings.
static unsigned int p_ids
Peer ids counter.
static int do_warmup
Do preconnect? (Each peer creates a tunnel to one other peer).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int GNUNET_STRINGS_fancy_time_to_relative(const char *fancy_time, struct GNUNET_TIME_Relative *rtime)
Convert a given fancy human-readable time to our internal representation.
Definition: strings.c:350
static int test_finished
Flag to notify callbacks not to generate any new traffic anymore.
static char * config_file
Set to the name of the config file used.
Definition: gnunet-arm.c:79
static struct GNUNET_TIME_Relative round_time
Duration of each round.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
const struct GNUNET_HashCode * GC_u2h(uint32_t port)
Transitional function to convert an unsigned int port to a hash value.
static void tmain(void *cls, struct GNUNET_CADET_TEST_Context *ctx, unsigned int num_peers, struct GNUNET_TESTBED_Peer **testbed_peers, struct GNUNET_CADET_Handle **cadetes)
test main: start test when all peers are connected
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static struct GNUNET_CONTAINER_MultiPeerMap * ids
GNUNET_PeerIdentity -> CadetPeer.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
static void * incoming_channel(void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options)
Method called whenever another peer has added us to a channel the other peer initiated.
static unsigned long long peers_total
Total number of peers.
A 512-bit hashcode.
static struct CadetPeer * peers
Operation to get peer ids.
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
static void channel_cleaner(void *cls, const struct GNUNET_CADET_Channel *channel, void *channel_ctx)
Function called whenever an inbound channel is destroyed.
long long atoll(const char *nptr)
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

Variable Documentation

◆ rounds

float rounds[] = { 0.8, 0.6, 0.8, 0.5, 0.3, 0.8, 0.0 }
static

Ratio of peers active.

First round always is 1.0.

Definition at line 59 of file gnunet-cadet-profiler.c.

Referenced by next_rnd().

◆ round_time

struct GNUNET_TIME_Relative round_time
static

Duration of each round.

Definition at line 164 of file gnunet-cadet-profiler.c.

Referenced by main(), next_rnd(), and start_test().

◆ ids

struct GNUNET_CONTAINER_MultiPeerMap* ids
static

GNUNET_PeerIdentity -> CadetPeer.

Definition at line 169 of file gnunet-cadet-profiler.c.

Referenced by GNUNET_RPS_seed_ids().

◆ testbed_handles

struct GNUNET_TESTBED_Peer** testbed_handles
static

Testbed peer handles.

Definition at line 174 of file gnunet-cadet-profiler.c.

◆ stats_op

struct GNUNET_TESTBED_Operation* stats_op
static

Testbed Operation (to get stats).

Definition at line 179 of file gnunet-cadet-profiler.c.

◆ peers

struct CadetPeer* peers
static

◆ p_ids

unsigned int p_ids
static

Peer ids counter.

Definition at line 189 of file gnunet-cadet-profiler.c.

Referenced by main(), and peer_id_cb().

◆ peers_total

unsigned long long peers_total
static

◆ peers_running

unsigned long long peers_running
static

Number of currently running peers.

Definition at line 199 of file gnunet-cadet-profiler.c.

Referenced by adjust_running_peers(), start_test(), and tmain().

◆ peers_pinging

unsigned long long peers_pinging
static

Number of peers doing pings.

Definition at line 204 of file gnunet-cadet-profiler.c.

Referenced by adjust_running_peers(), main(), show_end_data(), and start_test().

◆ test_ctx

struct GNUNET_CADET_TEST_Context* test_ctx
static

Test context (to shut down).

Definition at line 209 of file gnunet-cadet-profiler.c.

◆ disconnect_task

struct GNUNET_SCHEDULER_Task* disconnect_task
static

Task called to disconnect peers, before shutdown.

Definition at line 214 of file gnunet-cadet-profiler.c.

◆ test_task

struct GNUNET_SCHEDULER_Task* test_task
static

Task to perform tests.

Definition at line 219 of file gnunet-cadet-profiler.c.

◆ current_round

unsigned int current_round
static

Round number.

Definition at line 224 of file gnunet-cadet-profiler.c.

Referenced by next_rnd(), and tmt_rdy_ping().

◆ do_warmup

int do_warmup
static

Do preconnect? (Each peer creates a tunnel to one other peer).

Definition at line 229 of file gnunet-cadet-profiler.c.

Referenced by main(), and peer_id_cb().

◆ peers_warmup

unsigned int peers_warmup
static

Warmup progress.

Definition at line 234 of file gnunet-cadet-profiler.c.

Referenced by incoming_channel().

◆ test_finished

int test_finished
static

Flag to notify callbacks not to generate any new traffic anymore.

Definition at line 239 of file gnunet-cadet-profiler.c.

Referenced by finish_profiler(), main(), ping(), ping_handler(), and tmt_rdy_ping().

◆ round_task

struct GNUNET_SCHEDULER_Task* round_task
static

Task running each round of the benchmark.

Definition at line 244 of file gnunet-cadet-profiler.c.

◆ handlers

struct GNUNET_CADET_MessageHandler handlers[]
static
Initial value:
= {
{ &ping_handler, 1 , sizeof(struct CadetPingMessage) },
{ &pong_handler, 2 , sizeof(struct CadetPingMessage) },
{ NULL, 0, 0 }
}
int ping_handler(void *cls, struct GNUNET_CADET_Channel *channel, void **channel_ctx, const struct GNUNET_MessageHeader *message)
Function is called whenever a PING message is received.
int pong_handler(void *cls, struct GNUNET_CADET_Channel *channel, void **channel_ctx, const struct GNUNET_MessageHeader *message)
Function is called whenever a PONG message is received.
Message type for pings.

Handlers, for diverse services.

Definition at line 797 of file gnunet-cadet-profiler.c.

Referenced by GNUNET_TRANSPORT_core_get_mq(), and main().