GNUnet  0.20.0
gnunet-gns-benchmark.c File Reference

issue many queries to GNS and compute performance statistics More...

#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_gns_service.h>
Include dependency graph for gnunet-gns-benchmark.c:

Go to the source code of this file.

Data Structures

struct  Request
 Request we should make. More...
 

Macros

#define DEF_REQUEST_DELAY
 How long do we wait at least between requests by default? More...
 
#define DEF_TIMEOUT   GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1)
 How long do we wait until we consider a request failed by default? More...
 

Enumerations

enum  RequestCategory { RC_SHARED = 0 , RC_PRIVATE = 1 , RC_MAX = 2 }
 We distinguish between different categories of requests, for which we track statistics separately. More...
 

Functions

static void free_request (struct Request *req)
 Free req and data structures reachable from it. More...
 
static void process_result (void *cls, int gns_tld, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Function called with the result of a GNS resolution. More...
 
static void process_queue (void *cls)
 Process request from the queue. More...
 
static int compare_req (const void *c1, const void *c2)
 Compare two requests by latency for qsort(). More...
 
static void do_shutdown (void *cls)
 Output statistics, then clean up and terminate the process. More...
 
static void queue (const char *hostname, enum RequestCategory cat)
 Add hostname to the list of requests to be made. More...
 
static void process_stdin (void *cls)
 Begin processing hostnames from stdin. More...
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Process requests from the queue, then if the queue is not empty, try again. More...
 
int main (int argc, char *const *argv)
 Call with list of names with numeric category to query. More...
 

Variables

static struct GNUNET_GNS_Handlegns
 GNS handle. More...
 
static unsigned int lookups [RC_MAX]
 Number of lookups we performed overall per category. More...
 
static unsigned int replies [RC_MAX]
 Number of replies we got per category. More...
 
static unsigned int failures [RC_MAX]
 Number of replies we got per category. More...
 
static struct GNUNET_TIME_Relative latency_sum [RC_MAX]
 Sum of the observed latencies of successful queries, per category. More...
 
static struct Requestact_head
 Active requests are kept in a DLL. More...
 
static struct Requestact_tail
 Active requests are kept in a DLL. More...
 
static struct Requestsucc_head
 Completed successful requests are kept in a DLL. More...
 
static struct Requestsucc_tail
 Completed successful requests are kept in a DLL. More...
 
static struct Requesttodo_head
 Yet to be started requests are kept in a DLL. More...
 
static struct Requesttodo_tail
 Yet to be started requests are kept in a DLL. More...
 
static struct GNUNET_SCHEDULER_Taskt
 Main task. More...
 
static struct GNUNET_TIME_Relative request_delay
 Delay between requests. More...
 
static struct GNUNET_TIME_Relative timeout
 Timeout for requests. More...
 
static unsigned int active_cnt
 Number of requests we have concurrently active. More...
 
static int g2d
 Look for GNS2DNS records specifically? More...
 

Detailed Description

issue many queries to GNS and compute performance statistics

Author
Christian Grothoff

Definition in file gnunet-gns-benchmark.c.

Macro Definition Documentation

◆ DEF_REQUEST_DELAY

#define DEF_REQUEST_DELAY
Value:
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
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:484

How long do we wait at least between requests by default?

Definition at line 34 of file gnunet-gns-benchmark.c.

◆ DEF_TIMEOUT

How long do we wait until we consider a request failed by default?

Definition at line 40 of file gnunet-gns-benchmark.c.

Enumeration Type Documentation

◆ RequestCategory

We distinguish between different categories of requests, for which we track statistics separately.

However, this process does not change how it acts based on the category.

Enumerator
RC_SHARED 
RC_PRIVATE 
RC_MAX 

Must be last and match number of categories.

Definition at line 49 of file gnunet-gns-benchmark.c.

50 {
51  RC_SHARED = 0,
52  RC_PRIVATE = 1,
56  RC_MAX = 2
57 };
@ RC_MAX
Must be last and match number of categories.
@ RC_PRIVATE
@ RC_SHARED

Function Documentation

◆ free_request()

static void free_request ( struct Request req)
static

Free req and data structures reachable from it.

Parameters
reqrequest to free

Definition at line 194 of file gnunet-gns-benchmark.c.

195 {
196  if (NULL != req->lr)
198  GNUNET_free (req);
199 }
void * GNUNET_GNS_lookup_with_tld_cancel(struct GNUNET_GNS_LookupWithTldRequest *ltr)
Cancel pending lookup request.
Definition: gns_tld_api.c:332
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_GNS_LookupWithTldRequest * lr
Socket used to make the request, NULL if not active.

References GNUNET_free, GNUNET_GNS_lookup_with_tld_cancel(), and Request::lr.

Referenced by do_shutdown(), and process_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_result()

static void process_result ( void *  cls,
int  gns_tld,
uint32_t  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Function called with the result of a GNS resolution.

Parameters
clsclosure with the struct Request
gns_tldGNUNET_YES if GNS lookup was attempted
rd_countnumber of records in rd
rdthe records in reply

Definition at line 211 of file gnunet-gns-benchmark.c.

215 {
216  struct Request *req = cls;
217 
218  (void) gns_tld;
219  (void) rd_count;
220  (void) rd;
221  active_cnt--;
223  "Got response for request `%s'\n",
224  req->hostname);
225  req->lr = NULL;
228  act_tail,
229  req);
231  succ_tail,
232  req);
233  replies[req->cat]++;
234  latency_sum[req->cat]
236  req->latency);
237 }
static struct Request * succ_tail
Completed successful requests are kept in a DLL.
static unsigned int active_cnt
Number of requests we have concurrently active.
static struct GNUNET_TIME_Relative latency_sum[RC_MAX]
Sum of the observed latencies of successful queries, per category.
static struct Request * act_head
Active requests are kept in a DLL.
static struct Request * act_tail
Active requests are kept in a DLL.
static unsigned int replies[RC_MAX]
Number of replies we got per category.
static struct Request * succ_head
Completed successful requests are kept in a DLL.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_DEBUG
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:436
struct GNUNET_TIME_Relative GNUNET_TIME_relative_add(struct GNUNET_TIME_Relative a1, struct GNUNET_TIME_Relative a2)
Add relative times together.
Definition: time.c:585
Request we should make.
char * hostname
Hostname we are resolving.
struct GNUNET_TIME_Relative latency
Observed latency, set once we got a reply.
enum RequestCategory cat
Category of the request.
struct GNUNET_TIME_Absolute op_start_time
While we are fetching the record, the value is set to the starting time of the GNS operation.

References act_head, act_tail, active_cnt, Request::cat, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_relative_add(), Request::hostname, Request::latency, latency_sum, Request::lr, Request::op_start_time, rd, rd_count, replies, succ_head, and succ_tail.

Referenced by process_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_queue()

static void process_queue ( void *  cls)
static

Process request from the queue.

Parameters
clsNULL

Definition at line 246 of file gnunet-gns-benchmark.c.

247 {
248  struct Request *req;
250 
251  (void) cls;
252  t = NULL;
253  /* check for expired requests */
254  while (NULL != (req = act_head))
255  {
258  break;
260  act_tail,
261  req);
263  "Failing request `%s' due to timeout\n",
264  req->hostname);
265  failures[req->cat]++;
266  active_cnt--;
267  free_request (req);
268  }
269  if (NULL == (req = todo_head))
270  {
271  struct GNUNET_TIME_Absolute at;
272 
273  if (NULL == (req = act_head))
274  {
276  return;
277  }
279  timeout);
281  &process_queue,
282  NULL);
283  return;
284  }
286  todo_tail,
287  req);
289  act_tail,
290  req);
291  lookups[req->cat]++;
292  active_cnt++;
295  "Starting request `%s' (%u in parallel)\n",
296  req->hostname,
297  active_cnt);
299  req->hostname,
300  g2d
305  req);
307  &process_queue,
308  NULL);
309 }
#define GNUNET_GNSRECORD_TYPE_GNS2DNS
Delegation to DNS.
static struct Request * todo_head
Yet to be started requests are kept in a DLL.
static int g2d
Look for GNS2DNS records specifically?
static struct GNUNET_GNS_Handle * gns
GNS handle.
static void free_request(struct Request *req)
Free req and data structures reachable from it.
static void process_queue(void *cls)
Process request from the queue.
static struct GNUNET_SCHEDULER_Task * t
Main task.
static struct Request * todo_tail
Yet to be started requests are kept in a DLL.
static unsigned int failures[RC_MAX]
Number of replies we got per category.
static struct GNUNET_TIME_Relative timeout
Timeout for requests.
static struct GNUNET_TIME_Relative request_delay
Delay between requests.
static void process_result(void *cls, int gns_tld, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Function called with the result of a GNS resolution.
static unsigned int lookups[RC_MAX]
Number of lookups we performed overall per category.
static struct GNUNET_TIME_Relative duration
How long do we run the test?
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
struct GNUNET_GNS_LookupWithTldRequest * GNUNET_GNS_lookup_with_tld(struct GNUNET_GNS_Handle *handle, const char *name, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor2 proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS, determining the zone using the TLD of the given ...
Definition: gns_tld_api.c:241
@ GNUNET_GNS_LO_DEFAULT
Defaults, look in cache, then in DHT.
#define GNUNET_GNSRECORD_TYPE_ANY
Record type indicating any record/'*'.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:562
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_at(struct GNUNET_TIME_Absolute at, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run at the specified time.
Definition: scheduler.c:1249
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:1272
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:111
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Add a given relative duration to the given start time.
Definition: time.c:450
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.

References act_head, act_tail, active_cnt, Request::cat, duration, failures, free_request(), g2d, gns, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup_with_tld(), GNUNET_GNSRECORD_TYPE_ANY, GNUNET_GNSRECORD_TYPE_GNS2DNS, GNUNET_log, GNUNET_SCHEDULER_add_at(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_shutdown(), GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), Request::hostname, lookups, Request::lr, Request::op_start_time, process_result(), GNUNET_TIME_Relative::rel_value_us, request_delay, t, timeout, todo_head, and todo_tail.

Referenced by process_stdin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compare_req()

static int compare_req ( const void *  c1,
const void *  c2 
)
static

Compare two requests by latency for qsort().

Parameters
c1pointer to struct Request *
c2pointer to struct Request *
Returns
-1 if c1<c2, 1 if c1>c2, 0 if c1==c2.

Definition at line 320 of file gnunet-gns-benchmark.c.

322 {
323  const struct Request *r1 = *(void **) c1;
324  const struct Request *r2 = *(void **) c2;
325 
327  return -1;
329  return 1;
330  return 0;
331 }

References Request::latency, and GNUNET_TIME_Relative::rel_value_us.

Referenced by do_shutdown().

Here is the caller graph for this function:

◆ do_shutdown()

static void do_shutdown ( void *  cls)
static

Output statistics, then clean up and terminate the process.

Parameters
clsNULL

Definition at line 340 of file gnunet-gns-benchmark.c.

341 {
342  struct Request *req;
343  struct Request **ra[RC_MAX];
344  unsigned int rp[RC_MAX];
345 
346  (void) cls;
347  for (enum RequestCategory rc = 0; rc < RC_MAX; rc++)
348  {
349  ra[rc] = GNUNET_new_array (replies[rc],
350  struct Request *);
351  rp[rc] = 0;
352  }
353  for (req = succ_head; NULL != req; req = req->next)
354  {
355  GNUNET_assert (rp[req->cat] < replies[req->cat]);
356  ra[req->cat][rp[req->cat]++] = req;
357  }
358  for (enum RequestCategory rc = 0; rc < RC_MAX; rc++)
359  {
360  unsigned int off;
361 
362  fprintf (stdout,
363  "Category %u\n",
364  rc);
365  fprintf (stdout,
366  "\tlookups: %u replies: %u failures: %u\n",
367  lookups[rc],
368  replies[rc],
369  failures[rc]);
370  if (0 == rp[rc])
371  continue;
372  qsort (ra[rc],
373  rp[rc],
374  sizeof(struct Request *),
375  &compare_req);
377  replies[rc]);
378  fprintf (stdout,
379  "\taverage: %s\n",
381  GNUNET_YES));
382  off = rp[rc] * 50 / 100;
383  fprintf (stdout,
384  "\tmedian(50): %s\n",
386  GNUNET_YES));
387  off = rp[rc] * 75 / 100;
388  fprintf (stdout,
389  "\tquantile(75): %s\n",
391  GNUNET_YES));
392  off = rp[rc] * 90 / 100;
393  fprintf (stdout,
394  "\tquantile(90): %s\n",
396  GNUNET_YES));
397  off = rp[rc] * 99 / 100;
398  fprintf (stdout,
399  "\tquantile(99): %s\n",
401  GNUNET_YES));
402  GNUNET_free (ra[rc]);
403  }
404  if (NULL != t)
405  {
407  t = NULL;
408  }
409  while (NULL != (req = act_head))
410  {
412  act_tail,
413  req);
414  free_request (req);
415  }
416  while (NULL != (req = succ_head))
417  {
419  succ_tail,
420  req);
421  free_request (req);
422  }
423  while (NULL != (req = todo_head))
424  {
426  todo_tail,
427  req);
428  free_request (req);
429  }
430  if (NULL != gns)
431  {
433  gns = NULL;
434  }
435 }
RequestCategory
We distinguish between different categories of requests, for which we track statistics separately.
static int compare_req(const void *c1, const void *c2)
Compare two requests by latency for qsort().
static char * rp
Relying party.
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
Definition: gns_api.c:290
@ GNUNET_YES
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Divide relative time by a given factor.
Definition: time.c:550
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:569
struct Request * next
Requests are kept in a DLL.

References act_head, act_tail, Request::cat, compare_req(), failures, free_request(), gns, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_GNS_disconnect(), GNUNET_new_array, GNUNET_SCHEDULER_cancel(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_relative_divide(), GNUNET_YES, Request::latency, latency_sum, lookups, Request::next, RC_MAX, replies, rp, succ_head, succ_tail, t, todo_head, and todo_tail.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ queue()

static void queue ( const char *  hostname,
enum RequestCategory  cat 
)
static

Add hostname to the list of requests to be made.

Parameters
hostnamename to resolve
catcategory of the hostname

Definition at line 445 of file gnunet-gns-benchmark.c.

447 {
448  struct Request *req;
449  const char *dot;
450  size_t hlen;
451 
452  dot = strchr (hostname,
453  (unsigned char) '.');
454  if (NULL == dot)
455  {
457  "Refusing invalid hostname `%s' (lacks '.')\n",
458  hostname);
459  return;
460  }
461  hlen = strlen (hostname) + 1;
462  req = GNUNET_malloc (sizeof(struct Request) + hlen);
463  req->cat = cat;
464  req->hostname = (char *) &req[1];
465  GNUNET_memcpy (&req[1],
466  hostname,
467  hlen);
469  todo_tail,
470  req);
471 }
static char * hostname
Our hostname; we give this to all the peers we start.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_malloc(size)
Wrapper around malloc.

References Request::cat, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, Request::hostname, hostname, todo_head, and todo_tail.

Referenced by process_stdin().

Here is the caller graph for this function:

◆ process_stdin()

static void process_stdin ( void *  cls)
static

Begin processing hostnames from stdin.

Parameters
clsNULL

Definition at line 480 of file gnunet-gns-benchmark.c.

481 {
482  static struct GNUNET_TIME_Absolute last;
483  static uint64_t idot;
484  unsigned int cat;
485  char hn[256];
486  char in[270];
487 
488  (void) cls;
489  t = NULL;
490  while (NULL !=
491  fgets (in,
492  sizeof(in),
493  stdin))
494  {
495  if (strlen (in) > 0)
496  hn[strlen (in) - 1] = '\0'; /* eat newline */
497  if ((2 != sscanf (in,
498  "%u %255s",
499  &cat,
500  hn)) ||
501  (cat >= RC_MAX))
502  {
503  fprintf (stderr,
504  "Malformed input line `%s', skipping\n",
505  in);
506  continue;
507  }
508  if (0 == idot)
509  last = GNUNET_TIME_absolute_get ();
510  idot++;
511  if (0 == idot % 100000)
512  {
514 
516  last = GNUNET_TIME_absolute_get ();
517  fprintf (stderr,
518  "Read 100000 domain names in %s\n",
520  GNUNET_YES));
521  }
522  queue (hn,
523  (enum RequestCategory) cat);
524  }
525  fprintf (stderr,
526  "Done reading %llu domain names\n",
527  (unsigned long long) idot);
529  NULL);
530 }
static void queue(const char *hostname, enum RequestCategory cat)
Add hostname to the list of requests to be made.
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:1299
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:36

References delta, GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, process_queue(), queue(), RC_MAX, and t.

Referenced by run().

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

Process requests from the queue, then if the queue is not empty, try again.

Parameters
clsNULL
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cfgconfiguration

Definition at line 543 of file gnunet-gns-benchmark.c.

547 {
548  (void) cls;
549  (void) args;
550  (void) cfgfile;
552  NULL);
554  if (NULL == gns)
555  {
556  GNUNET_break (0);
558  return;
559  }
561  NULL);
562 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static void do_shutdown(void *cls)
Output statistics, then clean up and terminate the process.
static void process_stdin(void *cls)
Begin processing hostnames from stdin.
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
Definition: gns_api.c:268
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
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,...
Definition: scheduler.c:1334

References consensus-simulation::args, cfg, do_shutdown(), gns, GNUNET_break, GNUNET_GNS_connect(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), process_stdin(), and t.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

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

Call with list of names with numeric category to query.

Parameters
argcunused
argvunused
Returns
0 on success

Definition at line 573 of file gnunet-gns-benchmark.c.

575 {
576  int ret = 0;
579  "delay",
580  "RELATIVETIME",
581  gettext_noop (
582  "how long to wait between queries"),
583  &request_delay),
585  "timeout",
586  "RELATIVETIME",
587  gettext_noop (
588  "how long to wait for an answer"),
589  &timeout),
591  "g2d",
592  gettext_noop (
593  "look for GNS2DNS records instead of ANY"),
594  &g2d),
596  };
597 
598  if (GNUNET_OK !=
599  GNUNET_STRINGS_get_utf8_args (argc, argv,
600  &argc, &argv))
601  return 2;
604  if (GNUNET_OK !=
605  GNUNET_PROGRAM_run (argc,
606  argv,
607  "gnunet-gns-benchmark",
608  "resolve GNS names and measure performance",
609  options,
610  &run,
611  NULL))
612  ret = 1;
613  GNUNET_free_nz ((void *) argv);
614  return ret;
615 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define gettext_noop(String)
Definition: gettext.h:70
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
#define DEF_TIMEOUT
How long do we wait until we consider a request failed by default?
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Process requests from the queue, then if the queue is not empty, try again.
#define DEF_REQUEST_DELAY
How long do we wait at least between requests by default?
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 GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
@ GNUNET_OK
#define GNUNET_free_nz(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue 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,...
Definition: program.c:400
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1222
Definition of a command line option.

References DEF_REQUEST_DELAY, DEF_TIMEOUT, g2d, gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_relative_time(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), options, request_delay, ret, run(), and timeout.

Here is the call graph for this function:

Variable Documentation

◆ gns

struct GNUNET_GNS_Handle* gns
static

GNS handle.

Definition at line 110 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), process_queue(), and run().

◆ lookups

unsigned int lookups[RC_MAX]
static

Number of lookups we performed overall per category.

Definition at line 115 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), and process_queue().

◆ replies

unsigned int replies[RC_MAX]
static

Number of replies we got per category.

Definition at line 120 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), and process_result().

◆ failures

unsigned int failures[RC_MAX]
static

Number of replies we got per category.

Definition at line 125 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), and process_queue().

◆ latency_sum

struct GNUNET_TIME_Relative latency_sum[RC_MAX]
static

Sum of the observed latencies of successful queries, per category.

Definition at line 125 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), and process_result().

◆ act_head

struct Request* act_head
static

Active requests are kept in a DLL.

Definition at line 136 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), process_queue(), and process_result().

◆ act_tail

struct Request* act_tail
static

Active requests are kept in a DLL.

Definition at line 141 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), process_queue(), and process_result().

◆ succ_head

struct Request* succ_head
static

Completed successful requests are kept in a DLL.

Definition at line 146 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), and process_result().

◆ succ_tail

struct Request* succ_tail
static

Completed successful requests are kept in a DLL.

Definition at line 151 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), and process_result().

◆ todo_head

struct Request* todo_head
static

Yet to be started requests are kept in a DLL.

Definition at line 156 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), process_queue(), and queue().

◆ todo_tail

struct Request* todo_tail
static

Yet to be started requests are kept in a DLL.

Definition at line 161 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), process_queue(), and queue().

◆ t

struct GNUNET_SCHEDULER_Task* t
static

Main task.

Definition at line 166 of file gnunet-gns-benchmark.c.

Referenced by do_shutdown(), process_queue(), process_stdin(), and run().

◆ request_delay

struct GNUNET_TIME_Relative request_delay
static

Delay between requests.

Definition at line 166 of file gnunet-gns-benchmark.c.

Referenced by main(), and process_queue().

◆ timeout

struct GNUNET_TIME_Relative timeout
static

Timeout for requests.

Definition at line 166 of file gnunet-gns-benchmark.c.

Referenced by main(), and process_queue().

◆ active_cnt

unsigned int active_cnt
static

Number of requests we have concurrently active.

Definition at line 181 of file gnunet-gns-benchmark.c.

Referenced by process_queue(), and process_result().

◆ g2d

int g2d
static

Look for GNS2DNS records specifically?

Definition at line 186 of file gnunet-gns-benchmark.c.

Referenced by main(), and process_queue().