34#define DEF_REQUEST_DELAY GNUNET_TIME_relative_multiply ( \
35 GNUNET_TIME_UNIT_MILLISECONDS, 1)
40#define DEF_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1)
223 "Got response for request `%s'\n",
263 "Failing request `%s' due to timeout\n",
295 "Starting request `%s' (%u in parallel)\n",
323 const struct Request *r1 = *(
void **) c1;
324 const struct Request *r2 = *(
void **) c2;
366 "\tlookups: %u replies: %u failures: %u\n",
382 off =
rp[rc] * 50 / 100;
384 "\tmedian(50): %s\n",
387 off =
rp[rc] * 75 / 100;
389 "\tquantile(75): %s\n",
392 off =
rp[rc] * 90 / 100;
394 "\tquantile(90): %s\n",
397 off =
rp[rc] * 99 / 100;
399 "\tquantile(99): %s\n",
453 (
unsigned char)
'.');
457 "Refusing invalid hostname `%s' (lacks '.')\n",
483 static uint64_t idot;
496 hn[strlen (in) - 1] =
'\0';
497 if ((2 != sscanf (in,
504 "Malformed input line `%s', skipping\n",
511 if (0 == idot % 100000)
518 "Read 100000 domain names in %s\n",
526 "Done reading %llu domain names\n",
527 (
unsigned long long) idot);
582 "how long to wait between queries"),
588 "how long to wait for an answer"),
593 "look for GNS2DNS records instead of ANY"),
604 "gnunet-gns-benchmark",
605 "resolve GNS names and measure performance",
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
#define gettext_noop(String)
static int ret
Final status code.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
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 struct Request * succ_tail
Completed successful requests are kept in a DLL.
static void queue(const char *hostname, enum RequestCategory cat)
Add hostname to the list of requests to be made.
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.
RequestCategory
We distinguish between different categories of requests, for which we track statistics separately.
@ RC_MAX
Must be last and match number of categories.
static unsigned int active_cnt
Number of requests we have concurrently active.
#define DEF_TIMEOUT
How long do we wait until we consider a request failed by default?
static struct GNUNET_SCHEDULER_Task * t
Main task.
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 void do_shutdown(void *cls)
Output statistics, then clean up and terminate the process.
static struct Request * todo_tail
Yet to be started requests are kept in a DLL.
static int compare_req(const void *c1, const void *c2)
Compare two requests by latency for qsort().
static unsigned int failures[RC_MAX]
Number of replies we got per category.
static struct GNUNET_TIME_Relative timeout
Timeout for requests.
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.
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 Request * act_tail
Active requests are kept in a DLL.
int main(int argc, char *const *argv)
Call with list of names with numeric category to query.
#define DEF_REQUEST_DELAY
How long do we wait at least between requests by default?
static unsigned int replies[RC_MAX]
Number of replies we got per category.
static void process_stdin(void *cls)
Begin processing hostnames from stdin.
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.
static char * rp
Relying party.
static struct GNUNET_TIME_Relative duration
Option '-d': duration of the mapping.
API that can be used to manipulate GNS record data.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
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.
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
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 ...
void * GNUNET_GNS_lookup_with_tld_cancel(struct GNUNET_GNS_LookupWithTldRequest *ltr)
Cancel pending lookup request.
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
@ GNUNET_GNS_LO_DEFAULT
Defaults, look in cache, then in DHT.
#define GNUNET_GNSRECORD_TYPE_ANY
Record type indicating any record/'*'.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, 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,...
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
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.
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,...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
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.
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.
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...
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_add(struct GNUNET_TIME_Relative a1, struct GNUNET_TIME_Relative a2)
Add relative times together.
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.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Divide relative time by a given factor.
static struct GNUNET_TIME_Relative delta
#define GNUNET_GNSRECORD_TYPE_GNS2DNS
Delegation to DNS.
Definition of a command line option.
Connection to the GNS service.
Handle to a lookup request.
Entry in list of pending tasks.
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.
char * hostname
Hostname we are resolving, allocated at the end of this struct (optimizing memory consumption by redu...
struct Request * next
Active requests are kept in a DLL.
struct GNUNET_TIME_Relative latency
Observed latency, set once we got a reply.
const char * hostname
Hostname we are resolving, allocated at the end of this struct (optimizing memory consumption by redu...
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 DNS operation.
struct Request * prev
Active requests are kept in a DLL.
struct GNUNET_GNS_LookupWithTldRequest * lr
Socket used to make the request, NULL if not active.