GNUnet  0.11.x
Data Structures | Macros | Functions | Variables
gnunet-nse-profiler.c File Reference

Profiling driver for the network size estimation service. More...

#include "platform.h"
#include "gnunet_testbed_service.h"
#include "gnunet_nse_service.h"
Include dependency graph for gnunet-nse-profiler.c:

Go to the source code of this file.

Data Structures

struct  NSEPeer
 Information we track for a peer in the testbed. More...
 
struct  OpListEntry
 Operation map entry. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log (kind, __VA_ARGS__)
 Generic loggins shorthand. More...
 
#define LOG_DEBUG(...)   LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
 Debug logging shorthand. More...
 

Functions

static void close_monitor_connections ()
 Clean up all of the monitoring connections to NSE and STATISTICS that we keep to selected peers. More...
 
static void shutdown_task (void *cls)
 Task run on shutdown; cleans up everything. More...
 
static void handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, double estimate, double std_dev)
 Callback to call when network size estimate is updated. More...
 
static void * nse_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Adapter function called to establish a connection to NSE service. More...
 
static void nse_disconnect_adapter (void *cls, void *op_result)
 Adapter function called to destroy a connection to NSE service. More...
 
static int stat_iterator (void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
 Callback function to process statistic values. More...
 
static void * stat_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Called to open a connection to the peer's statistics. More...
 
static void stat_disconnect_adapter (void *cls, void *op_result)
 Called to disconnect from peer's statistics service. More...
 
static void stat_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
 Called after successfully opening a connection to a peer's statistics service; we register statistics monitoring for CORE and NSE here. More...
 
static void connect_nse_service ()
 Task run to connect to the NSE and statistics services to a subset of all of the running peers. More...
 
static void next_round (void *cls)
 Task that starts/stops peers to move to the next round. More...
 
static void finish_round (void *cls)
 We're at the end of a round. More...
 
static void run_round ()
 We have reached the desired number of peers for the current round. More...
 
static struct OpListEntrymake_oplist_entry ()
 Creates an oplist entry and adds it to the oplist DLL. More...
 
static void manage_service_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
 Callback to be called when NSE service is started or stopped at peers. More...
 
static void adjust_running_peers ()
 Adjust the number of running peers to match the required number of running peers for the round. More...
 
static void master_controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
 Function that will be called whenever something in the testbed changes. More...
 
static void test_master (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers_, struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, unsigned int links_failed)
 Signature of a main function for a testcase. More...
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Actual main function that runs the emulation. More...
 
int main (int argc, char *const *argv)
 Main function. More...
 

Variables

static struct NSEPeerpeer_head
 Head of DLL of peers we monitor closely. More...
 
static struct NSEPeerpeer_tail
 Tail of DLL of peers we monitor closely. More...
 
static int ok
 Return value from 'main' (0 == success) More...
 
static unsigned int verbose
 Be verbose (configuration option) More...
 
static char * hosts_file
 Name of the file with the hosts to run the test over (configuration option) More...
 
static unsigned int num_peers
 Maximum number of peers in the test. More...
 
static unsigned int num_rounds
 Total number of rounds to execute. More...
 
static unsigned int current_round
 Current round we are in. More...
 
static unsigned int * num_peers_in_round
 Array of size 'num_rounds' with the requested number of peers in the given round. More...
 
static unsigned int peers_running
 How many peers are running right now? More...
 
static char * num_peer_spec
 Specification for the numbers of peers to have in each round. More...
 
static struct GNUNET_TESTBED_Peer ** daemons
 Handles to all of the running peers. More...
 
static struct GNUNET_CONFIGURATION_Handletesting_cfg
 Global configuration file. More...
 
static unsigned int connection_limit
 Maximum number of connections to NSE services. More...
 
static unsigned int total_connections
 Total number of connections in the whole network. More...
 
static struct GNUNET_DISK_FileHandleoutput_file
 File to report results to. More...
 
static char * output_filename
 Filename to log results to. More...
 
static struct GNUNET_DISK_FileHandledata_file
 File to log connection info, statistics to. More...
 
static char * data_filename
 Filename to log connection info, statistics to. More...
 
static struct GNUNET_TIME_Relative wait_time = { 60 * 1000 }
 How long to wait before triggering next round? Default: 60 s. More...
 
static struct OpListEntryoplist_head
 DLL head for operation list. More...
 
static struct OpListEntryoplist_tail
 DLL tail for operation list. More...
 
static struct GNUNET_SCHEDULER_Taskround_task
 Task running each round of the experiment. More...
 

Detailed Description

Profiling driver for the network size estimation service.

Generally, the profiler starts a given number of peers, then churns some off, waits a certain amount of time, then churns again, and repeats.

Author
Christian Grothoff
Nathan Evans
Sree Harsha Totakura

Definition in file gnunet-nse-profiler.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log (kind, __VA_ARGS__)

Generic loggins shorthand.

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

Referenced by finish_round(), and manage_service_cb().

◆ LOG_DEBUG

#define LOG_DEBUG (   ...)    LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)

Function Documentation

◆ close_monitor_connections()

static void close_monitor_connections ( )
static

Clean up all of the monitoring connections to NSE and STATISTICS that we keep to selected peers.

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

References GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_TESTBED_operation_done(), NSEPeer::nse_op, OpListEntry::op, and NSEPeer::stat_op.

Referenced by finish_round(), and shutdown_task().

235 {
236  struct NSEPeer *pos;
237  struct OpListEntry *oplist_entry;
238 
239  while (NULL != (pos = peer_head))
240  {
241  if (NULL != pos->nse_op)
243  if (NULL != pos->stat_op)
246  GNUNET_free (pos);
247  }
248  while (NULL != (oplist_entry = oplist_head))
249  {
251  GNUNET_TESTBED_operation_done (oplist_entry->op);
252  GNUNET_free (oplist_entry);
253  }
254 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static struct NSEPeer * peer_head
Head of DLL of peers we monitor closely.
static struct OpListEntry * oplist_head
DLL head for operation list.
struct GNUNET_TESTBED_Operation * nse_op
Testbed operation to connect to NSE service.
Information we track for a peer in the testbed.
static struct OpListEntry * oplist_tail
DLL tail for operation list.
Operation map entry.
static struct NSEPeer * peer_tail
Tail of DLL of peers we monitor closely.
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:2044
struct GNUNET_TESTBED_Operation * stat_op
Testbed operation to connect to statistics service.
struct GNUNET_TESTBED_Operation * op
The testbed operation.
#define GNUNET_free(ptr)
Wrapper around free.
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

Task run on shutdown; cleans up everything.

Parameters
clsunused

Definition at line 263 of file gnunet-nse-profiler.c.

References close_monitor_connections(), GNUNET_CONFIGURATION_destroy(), GNUNET_DISK_file_close(), GNUNET_SCHEDULER_cancel(), and LOG_DEBUG.

Referenced by run().

264 {
265  LOG_DEBUG ("Ending test.\n");
267  if (NULL != round_task)
268  {
270  round_task = NULL;
271  }
272  if (NULL != data_file)
273  {
275  data_file = NULL;
276  }
277  if (NULL != output_file)
278  {
280  output_file = NULL;
281  }
282  if (NULL != testing_cfg)
283  {
285  testing_cfg = NULL;
286  }
287 }
static void close_monitor_connections()
Clean up all of the monitoring connections to NSE and STATISTICS that we keep to selected peers...
int GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1345
static struct GNUNET_DISK_FileHandle * data_file
File to log connection info, statistics to.
static struct GNUNET_SCHEDULER_Task * round_task
Task running each round of the experiment.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
static struct GNUNET_CONFIGURATION_Handle * testing_cfg
Global configuration file.
#define LOG_DEBUG(...)
Debug logging shorthand.
static struct GNUNET_DISK_FileHandle * output_file
File to report results to.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:966
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_estimate()

static void handle_estimate ( void *  cls,
struct GNUNET_TIME_Absolute  timestamp,
double  estimate,
double  std_dev 
)
static

Callback to call when network size estimate is updated.

Parameters
clsclosure with the 'struct NSEPeer' providing the update
timestampserver timestamp
estimatethe value of the current network size estimate
std_devstandard deviation (rounded down to nearest integer) of the size estimation values seen

Definition at line 300 of file gnunet-nse-profiler.c.

References GNUNET_TIME_Absolute::abs_value_us, GNUNET_DISK_file_write(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NSE_log_estimate_to_n, GNUNET_snprintf(), peer, peers_running, and size.

Referenced by nse_connect_adapter().

304 {
305  struct NSEPeer *peer = cls;
306  char output_buffer[512];
307  size_t size;
308 
309  if (NULL == output_file)
310  {
311  fprintf (stderr,
312  "Received network size estimate from peer %p. Size: %f std.dev. %f\n",
313  peer,
314  estimate,
315  std_dev);
316  return;
317  }
318  size = GNUNET_snprintf (output_buffer,
319  sizeof(output_buffer),
320  "%p %llu %llu %f %f %f\n",
321  peer,
323  (unsigned long long) timestamp.abs_value_us,
324  GNUNET_NSE_log_estimate_to_n (estimate),
325  estimate,
326  std_dev);
327  if (size != GNUNET_DISK_file_write (output_file, output_buffer, size))
328  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
329 }
int GNUNET_snprintf(char *buf, size_t size, const char *format,...)
Like snprintf, just aborts if the buffer is of insufficient size.
uint64_t abs_value_us
The actual value.
Information we track for a peer in the testbed.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:820
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static unsigned int size
Size of the "table".
Definition: peer.c:67
#define GNUNET_log(kind,...)
static unsigned int peers_running
How many peers are running right now?
#define GNUNET_NSE_log_estimate_to_n(loge)
Convert the logarithmic estimated returned to the 'GNUNET_NSE_Callback' into an absolute estimate in ...
static struct GNUNET_DISK_FileHandle * output_file
File to report results to.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nse_connect_adapter()

static void* nse_connect_adapter ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Adapter function called to establish a connection to NSE service.

Parameters
clsclosure (the 'struct NSEPeer')
cfgconfiguration of the peer to connect to; will be available until GNUNET_TESTBED_operation_done() is called on the operation returned from GNUNET_TESTBED_service_connect()
Returns
service handle to return in 'op_result', NULL on error

Definition at line 343 of file gnunet-nse-profiler.c.

References GNUNET_NSE_connect(), and handle_estimate().

Referenced by connect_nse_service().

344 {
345  struct NSEPeer *current_peer = cls;
346 
347  return GNUNET_NSE_connect (cfg, &handle_estimate, current_peer);
348 }
struct GNUNET_NSE_Handle * GNUNET_NSE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_NSE_Callback func, void *func_cls)
Connect to the network size estimation service.
Definition: nse_api.c:165
Information we track for a peer in the testbed.
static void handle_estimate(void *cls, struct GNUNET_TIME_Absolute timestamp, double estimate, double std_dev)
Callback to call when network size estimate is updated.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nse_disconnect_adapter()

static void nse_disconnect_adapter ( void *  cls,
void *  op_result 
)
static

Adapter function called to destroy a connection to NSE service.

Parameters
clsclosure
op_resultservice handle returned from the connect adapter

Definition at line 359 of file gnunet-nse-profiler.c.

References GNUNET_NSE_disconnect().

Referenced by connect_nse_service().

360 {
362 }
static int op_result(struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx, uint8_t cancel)
Remove an operation, and call its result callback (unless it was cancelled).
Definition: op.c:245
void GNUNET_NSE_disconnect(struct GNUNET_NSE_Handle *h)
Disconnect from network size estimation service.
Definition: nse_api.c:193
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stat_iterator()

static int stat_iterator ( void *  cls,
const char *  subsystem,
const char *  name,
uint64_t  value,
int  is_persistent 
)
static

Callback function to process statistic values.

Parameters
clsstruct NSEPeer
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 376 of file gnunet-nse-profiler.c.

References GNUNET_TIME_Absolute::abs_value_us, GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_file_write(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_absolute_get(), and size.

Referenced by stat_comp_cb(), and stat_disconnect_adapter().

381 {
382  char *output_buffer;
383  struct GNUNET_TIME_Absolute now;
384  int size;
385  unsigned int flag;
386 
387  GNUNET_assert (NULL != data_file);
388  now = GNUNET_TIME_absolute_get ();
389  flag = strcasecmp (subsystem, "core");
390  if (0 != flag)
391  flag = 1;
392  size = GNUNET_asprintf (&output_buffer,
393  "%llu %llu %u\n",
394  now.abs_value_us / 1000LL / 1000LL,
395  value,
396  flag);
397  if (0 > size)
398  {
399  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Error formatting output buffer.\n");
400  GNUNET_free (output_buffer);
401  return GNUNET_SYSERR;
402  }
403  if (size != GNUNET_DISK_file_write (data_file, output_buffer, (size_t) size))
404  {
405  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
406  GNUNET_free (output_buffer);
407  return GNUNET_SYSERR;
408  }
409  GNUNET_free (output_buffer);
410  return GNUNET_OK;
411 }
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_DISK_FileHandle * data_file
File to log connection info, statistics to.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
static char * value
Value of the record to add/remove.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:820
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static unsigned int size
Size of the "table".
Definition: peer.c:67
#define GNUNET_log(kind,...)
Time for absolute times used by GNUnet, in microseconds.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stat_connect_adapter()

static void* stat_connect_adapter ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Called to open a connection to the peer's statistics.

Parameters
clspeer context
cfgconfiguration of the peer to connect to; will be available until GNUNET_TESTBED_operation_done() is called on the operation returned from GNUNET_TESTBED_service_connect()
Returns
service handle to return in 'op_result', NULL on error

Definition at line 424 of file gnunet-nse-profiler.c.

References GNUNET_STATISTICS_create(), peer, and NSEPeer::sh.

Referenced by connect_nse_service().

425 {
426  struct NSEPeer *peer = cls;
427 
428  peer->sh = GNUNET_STATISTICS_create ("nse-profiler", cfg);
429  return peer->sh;
430 }
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
Information we track for a peer in the testbed.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_STATISTICS_Handle * sh
Handle to the statistics service.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stat_disconnect_adapter()

static void stat_disconnect_adapter ( void *  cls,
void *  op_result 
)
static

Called to disconnect from peer's statistics service.

Parameters
clspeer context
op_resultservice handle returned from the connect adapter

Definition at line 440 of file gnunet-nse-profiler.c.

References GNUNET_break, GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_destroy(), GNUNET_STATISTICS_watch_cancel(), peer, NSEPeer::sh, and stat_iterator().

Referenced by connect_nse_service().

441 {
442  struct NSEPeer *peer = cls;
443 
446  "core",
447  "# peers connected",
449  peer));
452  "nse",
453  "# peers connected",
455  peer));
457  peer->sh = NULL;
458 }
static int op_result(struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx, uint8_t cancel)
Remove an operation, and call its result callback (unless it was cancelled).
Definition: op.c:245
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Information we track for a peer in the testbed.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_STATISTICS_Handle * sh
Handle to the statistics service.
int GNUNET_STATISTICS_watch_cancel(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Iterator proc, void *proc_cls)
Stop watching statistics from the peer.
static int stat_iterator(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Callback function to process statistic values.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stat_comp_cb()

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

Called after successfully opening a connection to a peer's statistics service; we register statistics monitoring for CORE and NSE here.

Parameters
clsthe callback closure from functions generating an operation
opthe operation that has been finished
ca_resultthe service handle returned from GNUNET_TESTBED_ConnectAdapter()
emsgerror message in case the operation has failed; will be NULL if operation has executed successfully.

Definition at line 472 of file gnunet-nse-profiler.c.

References GNUNET_break, GNUNET_OK, GNUNET_STATISTICS_watch(), peer, NSEPeer::sh, and stat_iterator().

Referenced by connect_nse_service().

476 {
477  struct GNUNET_STATISTICS_Handle *sh = ca_result;
478  struct NSEPeer *peer = cls;
479 
480  if (NULL != emsg)
481  {
482  GNUNET_break (0);
483  return;
484  }
486  "core",
487  "# peers connected",
489  peer));
491  "nse",
492  "# peers connected",
494  peer));
495 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
Handle for the service.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Information we track for a peer in the testbed.
static struct SolverHandle * sh
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
int GNUNET_STATISTICS_watch(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Iterator proc, void *proc_cls)
Watch statistics from the peer (be notified whenever they change).
static int stat_iterator(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Callback function to process statistic values.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ connect_nse_service()

static void connect_nse_service ( )
static

Task run to connect to the NSE and statistics services to a subset of all of the running peers.

Definition at line 503 of file gnunet-nse-profiler.c.

References connection_limit, connections, current_round, NSEPeer::daemon, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_TESTBED_service_connect(), LOG_DEBUG, next_round(), nse_connect_adapter(), nse_disconnect_adapter(), NSEPeer::nse_op, num_peers_in_round, stat_comp_cb(), stat_connect_adapter(), stat_disconnect_adapter(), and NSEPeer::stat_op.

Referenced by run_round().

504 {
505  struct NSEPeer *current_peer;
506  unsigned int i;
507  unsigned int connections;
508 
509  if (0 == connection_limit)
510  return;
511  LOG_DEBUG ("Connecting to nse service of peers\n");
512  connections = 0;
513  for (i = 0; i < num_peers_in_round[current_round]; i++)
514  {
515  if ((num_peers_in_round[current_round] > connection_limit) &&
516  (0 != (i % (num_peers_in_round[current_round] / connection_limit))))
517  continue;
518  LOG_DEBUG ("Connecting to nse service of peer %d\n", i);
519  current_peer = GNUNET_new (struct NSEPeer);
520  current_peer->daemon = daemons[i];
521  current_peer->nse_op =
523  current_peer->daemon,
524  "nse",
525  NULL,
526  NULL,
529  current_peer);
530  if (NULL != data_file)
531  current_peer->stat_op =
533  current_peer->daemon,
534  "statistics",
535  stat_comp_cb,
536  current_peer,
539  current_peer);
541  if (++connections == connection_limit)
542  break;
543  }
544 }
static struct GNUNET_TESTBED_Peer ** daemons
Handles to all of the running peers.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
static unsigned int current_round
Current round we are in.
static struct NSEPeer * peer_head
Head of DLL of peers we monitor closely.
static void * stat_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Called to open a connection to the peer&#39;s statistics.
static struct GNUNET_DISK_FileHandle * data_file
File to log connection info, statistics to.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_CONTAINER_MultiShortmap * connections
Map from struct GNUNET_CADET_ConnectionTunnelIdentifier hash codes to struct CadetConnection objects...
struct GNUNET_TESTBED_Operation * nse_op
Testbed operation to connect to NSE service.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_service_connect(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_ServiceConnectCompletionCallback cb, void *cb_cls, GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_DisconnectAdapter da, void *cada_cls)
Connect to a service offered by the given peer.
Information we track for a peer in the testbed.
struct GNUNET_TESTBED_Peer * daemon
Handle with testbed.
static struct NSEPeer * peer_tail
Tail of DLL of peers we monitor closely.
static unsigned int connection_limit
Maximum number of connections to NSE services.
static void stat_comp_cb(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Called after successfully opening a connection to a peer&#39;s statistics service; we register statistics...
static unsigned int * num_peers_in_round
Array of size &#39;num_rounds&#39; with the requested number of peers in the given round. ...
static void nse_disconnect_adapter(void *cls, void *op_result)
Adapter function called to destroy a connection to NSE service.
static void * nse_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Adapter function called to establish a connection to NSE service.
struct GNUNET_TESTBED_Operation * stat_op
Testbed operation to connect to statistics service.
#define LOG_DEBUG(...)
Debug logging shorthand.
static void stat_disconnect_adapter(void *cls, void *op_result)
Called to disconnect from peer&#39;s statistics service.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ next_round()

static void next_round ( void *  cls)
static

Task that starts/stops peers to move to the next round.

Task run at the end of a round.

Parameters
clsNULL, unused

Disconnect from all monitored peers; then get statistics from all peers.

Parameters
clsNULL, unused

Definition at line 674 of file gnunet-nse-profiler.c.

References adjust_running_peers(), current_round, GNUNET_SCHEDULER_shutdown(), LOG_DEBUG, num_peers_in_round, num_rounds, ok, peers_running, and run_round().

Referenced by connect_nse_service(), and finish_round().

675 {
676  round_task = NULL;
677  LOG_DEBUG ("Disconnecting nse service of peers\n");
678  current_round++;
679  if (current_round == num_rounds)
680  {
681  /* this was the last round, terminate */
682  ok = 0;
684  return;
685  }
687  {
688  /* no need to churn, just run next round */
689  run_round ();
690  return;
691  }
693 }
static unsigned int current_round
Current round we are in.
static int ok
Return value from &#39;main&#39; (0 == success)
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:526
static struct GNUNET_SCHEDULER_Task * round_task
Task running each round of the experiment.
static void adjust_running_peers()
Adjust the number of running peers to match the required number of running peers for the round...
static unsigned int num_rounds
Total number of rounds to execute.
static unsigned int * num_peers_in_round
Array of size &#39;num_rounds&#39; with the requested number of peers in the given round. ...
static void run_round()
We have reached the desired number of peers for the current round.
static unsigned int peers_running
How many peers are running right now?
#define LOG_DEBUG(...)
Debug logging shorthand.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ finish_round()

static void finish_round ( void *  cls)
static

We're at the end of a round.

Stop monitoring, write total number of connections to log and get full stats. Then trigger the next round.

Parameters
clsunused, NULL

Definition at line 564 of file gnunet-nse-profiler.c.

References close_monitor_connections(), GNUNET_ERROR_TYPE_INFO, GNUNET_SCHEDULER_add_now(), LOG, next_round(), and total_connections.

Referenced by run_round().

565 {
566  LOG (GNUNET_ERROR_TYPE_INFO, "Have %u connections\n", total_connections);
569 }
static void close_monitor_connections()
Clean up all of the monitoring connections to NSE and STATISTICS that we keep to selected peers...
static void next_round(void *cls)
Task that starts/stops peers to move to the next round.
static struct GNUNET_SCHEDULER_Task * round_task
Task running each round of the experiment.
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:1280
static unsigned int total_connections
Total number of connections in the whole network.
#define LOG(kind,...)
Generic loggins shorthand.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_round()

static void run_round ( )
static

We have reached the desired number of peers for the current round.

Run it (by connecting and monitoring a few peers and waiting the specified delay before finishing the round).

Definition at line 578 of file gnunet-nse-profiler.c.

References connect_nse_service(), current_round, finish_round(), GNUNET_SCHEDULER_add_delayed(), and LOG_DEBUG.

Referenced by manage_service_cb(), next_round(), and test_master().

579 {
580  LOG_DEBUG ("Running round %u\n", current_round);
583 }
static unsigned int current_round
Current round we are in.
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:1253
static struct GNUNET_TIME_Relative wait_time
How long to wait before triggering next round? Default: 60 s.
static void finish_round(void *cls)
We&#39;re at the end of a round.
static void connect_nse_service()
Task run to connect to the NSE and statistics services to a subset of all of the running peers...
#define LOG_DEBUG(...)
Debug logging shorthand.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_oplist_entry()

static struct OpListEntry* make_oplist_entry ( )
static

Creates an oplist entry and adds it to the oplist DLL.

Definition at line 590 of file gnunet-nse-profiler.c.

References GNUNET_CONTAINER_DLL_insert_tail, and GNUNET_new.

Referenced by adjust_running_peers().

591 {
592  struct OpListEntry *entry;
593 
594  entry = GNUNET_new (struct OpListEntry);
596  return entry;
597 }
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct OpListEntry * oplist_head
DLL head for operation list.
static struct OpListEntry * oplist_tail
DLL tail for operation list.
Operation map entry.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
Here is the caller graph for this function:

◆ manage_service_cb()

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

Callback to be called when NSE service is started or stopped at peers.

Parameters
clsNULL
opthe operation handle
emsgNULL on success; otherwise an error description

Definition at line 608 of file gnunet-nse-profiler.c.

References current_round, OpListEntry::delta, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_operation_done(), LOG, num_peers_in_round, OpListEntry::op, peers_running, and run_round().

Referenced by adjust_running_peers().

611 {
612  struct OpListEntry *entry = cls;
613 
615  if (NULL != emsg)
616  {
617  LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to start/stop NSE at a peer\n");
619  return;
620  }
621  GNUNET_assert (0 != entry->delta);
622  peers_running += entry->delta;
624  GNUNET_free (entry);
626  run_round ();
627 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static unsigned int current_round
Current round we are in.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:526
static struct OpListEntry * oplist_head
DLL head for operation list.
static struct OpListEntry * oplist_tail
DLL tail for operation list.
Operation map entry.
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:2044
int delta
Depending on whether we start or stop NSE service at the peer set this to 1 or -1.
static unsigned int * num_peers_in_round
Array of size &#39;num_rounds&#39; with the requested number of peers in the given round. ...
#define LOG(kind,...)
Generic loggins shorthand.
static void run_round()
We have reached the desired number of peers for the current round.
static unsigned int peers_running
How many peers are running right now?
struct GNUNET_TESTBED_Operation * op
The testbed operation.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ adjust_running_peers()

static void adjust_running_peers ( )
static

Adjust the number of running peers to match the required number of running peers for the round.

Definition at line 635 of file gnunet-nse-profiler.c.

References current_round, OpListEntry::delta, GNUNET_TESTBED_peer_manage_service(), make_oplist_entry(), manage_service_cb(), num_peers_in_round, OpListEntry::op, and peers_running.

Referenced by next_round(), and test_master().

636 {
637  struct OpListEntry *entry;
638  unsigned int i;
639 
640  /* start peers if we have too few */
641  for (i = peers_running; i < num_peers_in_round[current_round]; i++)
642  {
643  entry = make_oplist_entry ();
644  entry->delta = 1;
645  entry->op = GNUNET_TESTBED_peer_manage_service (NULL,
646  daemons[i],
647  "nse",
649  entry,
650  1);
651  }
652  /* stop peers if we have too many */
653  for (i = num_peers_in_round[current_round]; i < peers_running; i++)
654  {
655  entry = make_oplist_entry ();
656  entry->delta = -1;
657  entry->op = GNUNET_TESTBED_peer_manage_service (NULL,
658  daemons[i],
659  "nse",
661  entry,
662  0);
663  }
664 }
static struct GNUNET_TESTBED_Peer ** daemons
Handles to all of the running peers.
static unsigned int current_round
Current round we are in.
static struct OpListEntry * make_oplist_entry()
Creates an oplist entry and adds it to the oplist DLL.
Operation map entry.
int delta
Depending on whether we start or stop NSE service at the peer set this to 1 or -1.
static unsigned int * num_peers_in_round
Array of size &#39;num_rounds&#39; with the requested number of peers in the given round. ...
static void manage_service_cb(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when NSE service is started or stopped at peers.
static unsigned int peers_running
How many peers are running right now?
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.
struct GNUNET_TESTBED_Operation * op
The testbed operation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ master_controller_cb()

static void master_controller_cb ( void *  cls,
const struct GNUNET_TESTBED_EventInformation event 
)
static

Function that will be called whenever something in the testbed changes.

Parameters
clsclosure, NULL
eventinformation on what is happening

Definition at line 704 of file gnunet-nse-profiler.c.

References GNUNET_TESTBED_ET_CONNECT, GNUNET_TESTBED_ET_DISCONNECT, total_connections, and GNUNET_TESTBED_EventInformation::type.

Referenced by run().

706 {
707  switch (event->type)
708  {
711  break;
712 
715  break;
716 
717  default:
718  break;
719  }
720 }
enum GNUNET_TESTBED_EventType type
Type of the event.
static unsigned int total_connections
Total number of connections in the whole network.
A connection between two peers was torn down.
A connection between two peers was established.
Here is the caller graph for this function:

◆ test_master()

static void test_master ( void *  cls,
struct GNUNET_TESTBED_RunHandle h,
unsigned int  num_peers_,
struct GNUNET_TESTBED_Peer **  peers,
unsigned int  links_succeeded,
unsigned int  links_failed 
)
static

Signature of a main function for a testcase.

Parameters
clsNULL
hthe run handle
num_peers_number of peers in 'peers'
peershandle to peers run in the testbed. NULL upon timeout (see GNUNET_TESTBED_test_run()).
links_succeededthe number of overlay link connection attempts that succeeded
links_failedthe number of overlay link connection attempts that failed

Definition at line 737 of file gnunet-nse-profiler.c.

References adjust_running_peers(), current_round, GNUNET_break, GNUNET_SCHEDULER_shutdown(), num_peers, num_peers_in_round, peers, peers_running, and run_round().

Referenced by run().

743 {
744  if (NULL == peers)
745  {
747  return;
748  }
749  daemons = peers;
750  GNUNET_break (num_peers_ == num_peers);
753  {
754  /* no need to churn, just run the starting round */
755  run_round ();
756  return;
757  }
759 }
static struct GNUNET_TESTBED_Peer ** daemons
Handles to all of the running peers.
static unsigned int current_round
Current round we are in.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:526
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static unsigned int num_peers
Maximum number of peers in the test.
static void adjust_running_peers()
Adjust the number of running peers to match the required number of running peers for the round...
static unsigned int * num_peers_in_round
Array of size &#39;num_rounds&#39; with the requested number of peers in the given round. ...
static struct CadetPeer * peers
Operation to get peer ids.
static void run_round()
We have reached the desired number of peers for the current round.
static unsigned int peers_running
How many peers are running right now?
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Actual main function that runs the emulation.

Parameters
clsunused
argsremaining args, unused
cfgfilename of the configuration
cfgconfiguration handle

Definition at line 771 of file gnunet-nse-profiler.c.

References data_filename, event_mask, GNUNET_array_append, GNUNET_CONFIGURATION_dup(), GNUNET_DISK_file_open(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_READWRITE, GNUNET_DISK_OPEN_TRUNCATE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_ERROR, GNUNET_log_strerror_file, GNUNET_MAX, GNUNET_SCHEDULER_add_shutdown(), GNUNET_TESTBED_ET_CONNECT, GNUNET_TESTBED_ET_DISCONNECT, GNUNET_TESTBED_ET_PEER_START, GNUNET_TESTBED_ET_PEER_STOP, GNUNET_TESTBED_run(), hosts_file, LOG_DEBUG, master_controller_cb(), num_peer_spec, num_peers, num_peers_in_round, num_rounds, ok, output_filename, shutdown_task(), and test_master().

Referenced by main().

775 {
776  char *tok;
777  uint64_t event_mask;
778  unsigned int num;
779 
780  ok = 1;
782  LOG_DEBUG ("Starting daemons.\n");
783  if (NULL == num_peer_spec)
784  {
785  fprintf (stderr, "You need to specify the number of peers to run\n");
786  return;
787  }
788  for (tok = strtok (num_peer_spec, ","); NULL != tok; tok = strtok (NULL, ","))
789  {
790  if (1 != sscanf (tok, "%u", &num))
791  {
792  fprintf (stderr, "You need to specify numbers, not `%s'\n", tok);
793  return;
794  }
795  if (0 == num)
796  {
797  fprintf (stderr, "Refusing to run a round with 0 peers\n");
798  return;
799  }
801  num_peers = GNUNET_MAX (num_peers, num);
802  }
803  if (0 == num_peers)
804  {
805  fprintf (stderr, "Refusing to run a testbed with no rounds\n");
806  return;
807  }
808  if ((NULL != data_filename) &&
809  (NULL ==
817 
818  if ((NULL != output_filename) &&
819  (NULL ==
826  event_mask = 0LL;
827  event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START);
828  event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_STOP);
829  event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
830  event_mask |= (1LL << GNUNET_TESTBED_ET_DISCONNECT);
832  cfg,
833  num_peers,
834  event_mask,
836  NULL, /* master_controller_cb cls */
837  &test_master,
838  NULL); /* test_master cls */
840 }
Create file if it doesn&#39;t exist.
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:1300
static int ok
Return value from &#39;main&#39; (0 == success)
static void test_master(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers_, struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, unsigned int links_failed)
Signature of a main function for a testcase.
static struct GNUNET_DISK_FileHandle * data_file
File to log connection info, statistics to.
static char * hosts_file
Name of the file with the hosts to run the test over (configuration option)
static void master_controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Function that will be called whenever something in the testbed changes.
static void shutdown_task(void *cls)
Task run on shutdown; cleans up everything.
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
static unsigned int num_peers
Maximum number of peers in the test.
Truncate file if it exists.
#define GNUNET_MAX(a, b)
Definition: gnunet_common.h:82
static char * data_filename
Filename to log connection info, statistics to.
static struct GNUNET_CONFIGURATION_Handle * testing_cfg
Global configuration file.
void GNUNET_TESTBED_run(const char *host_filename, const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int num_peers, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls, GNUNET_TESTBED_TestMaster test_master, void *test_master_cls)
Convenience method for running a testbed with a single call.
A connection between two peers was torn down.
uint64_t event_mask
Global event mask for all testbed events.
A connection between two peers was established.
static unsigned int num_rounds
Total number of rounds to execute.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
static unsigned int * num_peers_in_round
Array of size &#39;num_rounds&#39; with the requested number of peers in the given round. ...
#define GNUNET_array_append(arr, size, element)
Append an element to a list (growing the list by one).
static char * num_peer_spec
Specification for the numbers of peers to have in each round.
Open the file for both reading and writing.
A peer has been stopped.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition: disk.c:1268
#define LOG_DEBUG(...)
Debug logging shorthand.
static struct GNUNET_DISK_FileHandle * output_file
File to report results to.
static char * output_filename
Filename to log results to.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 
)

Main function.

Returns
0 on success

Definition at line 849 of file gnunet-nse-profiler.c.

References connection_limit, data_filename, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_increment_uint(), GNUNET_GETOPT_option_relative_time(), GNUNET_GETOPT_option_string(), GNUNET_GETOPT_option_uint(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), hosts_file, num_peer_spec, ok, output_filename, run(), and verbose.

850 {
853  'C',
854  "connections",
855  "COUNT",
856  gettext_noop (
857  "limit to the number of connections to NSE services, 0 for none"),
860  'd',
861  "details",
862  "FILENAME",
863  gettext_noop (
864  "name of the file for writing connection information and statistics"),
865  &data_filename),
866 
868  'H',
869  "hosts",
870  "FILENAME",
871  gettext_noop (
872  "name of the file with the login information for the testbed"),
873  &hosts_file),
874 
876  'o',
877  "output",
878  "FILENAME",
879  gettext_noop ("name of the file for writing the main results"),
880  &output_filename),
881 
882 
884  'p',
885  "peers",
886  "NETWORKSIZESPEC",
887  gettext_noop (
888  "Number of peers to run in each round, separated by commas"),
889  &num_peer_spec),
890 
892  'V',
893  "verbose",
894  gettext_noop ("be verbose (print progress information)"),
895  &verbose),
896 
898  "wait",
899  "DELAY",
900  gettext_noop ("delay between rounds"),
901  &wait_time),
903 
904  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
905  return 2;
906  if (
907  GNUNET_OK !=
908  GNUNET_PROGRAM_run (argc,
909  argv,
910  "nse-profiler",
911  gettext_noop (
912  "Measure quality and performance of the NSE service."),
913  options,
914  &run,
915  NULL))
916  ok = 1;
917  return ok;
918 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time)...
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1438
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_increment_uint(char shortName, const char *name, const char *description, unsigned int *val)
Increment val each time the option flag is given by one.
static int ok
Return value from &#39;main&#39; (0 == success)
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
Definition of a command line option.
static char * hosts_file
Name of the file with the hosts to run the test over (configuration option)
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
static char * data_filename
Filename to log connection info, statistics to.
static unsigned int verbose
Be verbose (configuration option)
static struct GNUNET_TIME_Relative wait_time
How long to wait before triggering next round? Default: 60 s.
static unsigned int connection_limit
Maximum number of connections to NSE services.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Actual main function that runs the emulation.
static char * num_peer_spec
Specification for the numbers of peers to have in each round.
int GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
Definition: program.c:367
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned int *val)
Allow user to specify an unsigned int.
static char * output_filename
Filename to log results to.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

Variable Documentation

◆ peer_head

struct NSEPeer* peer_head
static

Head of DLL of peers we monitor closely.

Definition at line 115 of file gnunet-nse-profiler.c.

◆ peer_tail

struct NSEPeer* peer_tail
static

Tail of DLL of peers we monitor closely.

Definition at line 120 of file gnunet-nse-profiler.c.

◆ ok

int ok
static

◆ verbose

unsigned int verbose
static

Be verbose (configuration option)

Definition at line 130 of file gnunet-nse-profiler.c.

Referenced by main().

◆ hosts_file

char* hosts_file
static

Name of the file with the hosts to run the test over (configuration option)

Definition at line 135 of file gnunet-nse-profiler.c.

Referenced by main(), and run().

◆ num_peers

unsigned int num_peers
static

Maximum number of peers in the test.

Definition at line 140 of file gnunet-nse-profiler.c.

Referenced by run(), and test_master().

◆ num_rounds

unsigned int num_rounds
static

Total number of rounds to execute.

Definition at line 145 of file gnunet-nse-profiler.c.

Referenced by next_round(), and run().

◆ current_round

unsigned int current_round
static

Current round we are in.

Definition at line 150 of file gnunet-nse-profiler.c.

Referenced by adjust_running_peers(), connect_nse_service(), manage_service_cb(), next_round(), run_round(), and test_master().

◆ num_peers_in_round

unsigned int* num_peers_in_round
static

Array of size 'num_rounds' with the requested number of peers in the given round.

Definition at line 155 of file gnunet-nse-profiler.c.

Referenced by adjust_running_peers(), connect_nse_service(), manage_service_cb(), next_round(), run(), and test_master().

◆ peers_running

unsigned int peers_running
static

How many peers are running right now?

Definition at line 160 of file gnunet-nse-profiler.c.

Referenced by adjust_running_peers(), handle_estimate(), manage_service_cb(), next_round(), and test_master().

◆ num_peer_spec

char* num_peer_spec
static

Specification for the numbers of peers to have in each round.

Definition at line 165 of file gnunet-nse-profiler.c.

Referenced by main(), and run().

◆ daemons

struct GNUNET_TESTBED_Peer** daemons
static

Handles to all of the running peers.

Definition at line 170 of file gnunet-nse-profiler.c.

◆ testing_cfg

struct GNUNET_CONFIGURATION_Handle* testing_cfg
static

Global configuration file.

Definition at line 175 of file gnunet-nse-profiler.c.

◆ connection_limit

unsigned int connection_limit
static

Maximum number of connections to NSE services.

Definition at line 180 of file gnunet-nse-profiler.c.

Referenced by connect_nse_service(), and main().

◆ total_connections

unsigned int total_connections
static

Total number of connections in the whole network.

Definition at line 185 of file gnunet-nse-profiler.c.

Referenced by finish_round(), and master_controller_cb().

◆ output_file

struct GNUNET_DISK_FileHandle* output_file
static

File to report results to.

Definition at line 190 of file gnunet-nse-profiler.c.

◆ output_filename

char* output_filename
static

Filename to log results to.

Definition at line 195 of file gnunet-nse-profiler.c.

Referenced by main(), and run().

◆ data_file

struct GNUNET_DISK_FileHandle* data_file
static

File to log connection info, statistics to.

Definition at line 200 of file gnunet-nse-profiler.c.

◆ data_filename

char* data_filename
static

Filename to log connection info, statistics to.

Definition at line 205 of file gnunet-nse-profiler.c.

Referenced by main(), and run().

◆ wait_time

struct GNUNET_TIME_Relative wait_time = { 60 * 1000 }
static

How long to wait before triggering next round? Default: 60 s.

Definition at line 211 of file gnunet-nse-profiler.c.

◆ oplist_head

struct OpListEntry* oplist_head
static

DLL head for operation list.

Definition at line 216 of file gnunet-nse-profiler.c.

◆ oplist_tail

struct OpListEntry* oplist_tail
static

DLL tail for operation list.

Definition at line 221 of file gnunet-nse-profiler.c.

◆ round_task

struct GNUNET_SCHEDULER_Task* round_task
static

Task running each round of the experiment.

Definition at line 226 of file gnunet-nse-profiler.c.