GNUnet 0.22.1
gnunet-statistics.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2004-2007, 2009, 2016 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
27#include "platform.h"
28#include "gnunet_util_lib.h"
30
31
35static int ret;
36
40static char *subsystem;
41
45static char *path_testbed;
46
50static char *name;
51
55static int persistent;
56
60static int watch;
61
65static int quiet;
66
70static char *csv_separator_opt;
71
75static const char *csv_separator;
76
80static char *remote_host;
81
85static unsigned long long remote_port;
86
90static unsigned long long set_val;
91
95static int set_value;
96
100static struct Node
101{
105 unsigned index_node;
106
111
116
126
130static unsigned num_nodes;
131
136{
141
145 char *name;
146
150 uint64_t *values;
151
156};
157
158
163
168
173
174
184static struct ValueSet *
185new_value_set (const char *subsys,
186 const char *new_name,
187 unsigned num_values,
188 int is_persistent)
189{
190 struct ValueSet *value_set;
191
192 value_set = GNUNET_new (struct ValueSet);
193 value_set->subsystem = GNUNET_strdup (subsys);
194 value_set->name = GNUNET_strdup (new_name);
195 value_set->values = GNUNET_new_array (num_values,
196 uint64_t);
197 value_set->is_persistent = persistent;
198 return value_set;
199}
200
201
213static int
214printer (void *cls,
215 const struct GNUNET_HashCode *key,
216 void *value)
217{
219 const char *now_str;
220 struct ValueSet *value_set = value;
221
222 if (quiet == GNUNET_NO)
223 {
224 if (GNUNET_YES == watch)
225 {
227 fprintf (stdout,
228 "%24s%s %s%s%12s%s %s%50s%s%s ",
229 now_str,
231 value_set->is_persistent ? "!" : " ",
233 value_set->subsystem,
235 (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
236 _ (value_set->name),
237 (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
238 (0 == strlen (csv_separator) ? ":" : csv_separator));
239 }
240 else
241 {
242 fprintf (stdout,
243 "%s%s%12s%s %s%50s%s%s ",
244 value_set->is_persistent ? "!" : " ",
246 value_set->subsystem,
248 (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
249 _ (value_set->name),
250 (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
251 (0 == strlen (csv_separator) ? ":" : csv_separator));
252 }
253 }
254 for (unsigned i = 0; i < num_nodes; i++)
255 {
256 fprintf (stdout,
257 "%16llu%s",
258 (unsigned long long) value_set->values[i],
260 }
261 fprintf (stdout, "\n");
262 GNUNET_free (value_set->subsystem);
263 GNUNET_free (value_set->name);
264 GNUNET_free (value_set->values);
265 GNUNET_free (value_set);
266 return GNUNET_YES;
267}
268
269
280static int
281printer_watch (void *cls,
282 const char *subsys,
283 const char *print_name,
284 uint64_t value,
285 int is_persistent)
286{
288 const char *now_str;
289
290 if (quiet == GNUNET_NO)
291 {
292 if (GNUNET_YES == watch)
293 {
295 fprintf (stdout,
296 "%24s%s %s%s%12s%s %s%50s%s%s %16llu\n",
297 now_str,
299 is_persistent ? "!" : " ",
301 subsys,
303 (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
304 _ (print_name),
305 (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
306 (0 == strlen (csv_separator) ? ":" : csv_separator),
307 (unsigned long long) value);
308 }
309 else
310 {
311 fprintf (stdout,
312 "%s%s%12s%s %s%50s%s%s %16llu\n",
313 is_persistent ? "!" : " ",
315 subsys,
317 (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
318 _ (print_name),
319 (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
320 (0 == strlen (csv_separator) ? ":" : csv_separator),
321 (unsigned long long) value);
322 }
323 }
324 else
325 fprintf (stdout, "%llu\n", (unsigned long long) value);
326
327 return GNUNET_OK;
328}
329
330
338static void
339clean_node (void *cls)
340{
341 const unsigned index_node = *(unsigned *) cls;
344
345 if ((NULL != path_testbed) && /* were issued with -t <testbed-path> option */
346 (NULL != nodes[index_node].conf))
347 {
349 nodes[index_node].conf = NULL;
350 }
351
352 h = nodes[index_node].handle;
353 gh = nodes[index_node].gh;
354
355 if (NULL != gh)
356 {
358 gh = NULL;
359 }
360 if (GNUNET_YES == watch)
361 {
363 GNUNET_OK ==
365 subsystem,
366 name,
368 &nodes[index_node].index_node));
369 }
370
371 if (NULL != h)
372 {
374 h = NULL;
375 }
376
378}
379
380
386static void
388{
390 &printer,
391 NULL);
395}
396
397
406static void
408 int success)
409{
410 const unsigned index_node = *(unsigned *) cls;
411
412 nodes[index_node].gh = NULL;
413 if (GNUNET_OK != success)
414 {
415 if (NULL == remote_host)
416 fprintf (stderr,
417 "%s",
418 _ ("Failed to obtain statistics.\n"));
419 else
420 fprintf (stderr,
421 _ ("Failed to obtain statistics from host `%s:%llu'\n"),
424 ret = 1;
425 }
426 if (NULL != nodes[index_node].shutdown_task)
427 {
429 nodes[index_node].shutdown_task = NULL;
430 }
432 &nodes[index_node].index_node);
435 {
437 NULL);
438 }
439}
440
441
449static void
451 int success)
452{
453 for (unsigned i = 0; i < num_nodes; i++)
454 {
455 nodes[i].gh = NULL;
456 }
457 if (GNUNET_OK != success)
458 {
459 if (NULL == remote_host)
460 fprintf (stderr, "%s", _ ("Failed to obtain statistics.\n"));
461 else
462 fprintf (stderr,
463 _ ("Failed to obtain statistics from host `%s:%llu'\n"),
466 ret = 1;
467 }
469}
470
471
483static int
485 const char *subsys,
486 const char *coll_name,
487 uint64_t value,
488 int is_persistent)
489{
490 const unsigned index_node = *(unsigned *) cls;
491 struct GNUNET_HashCode *key;
492 struct GNUNET_HashCode hc;
493 char *subsys_name;
494 unsigned len_subsys_name;
495 struct ValueSet *value_set;
496
497 len_subsys_name = strlen (subsys) + 3 + strlen (coll_name) + 1;
498 subsys_name = GNUNET_malloc (len_subsys_name);
499 sprintf (subsys_name, "%s---%s", subsys, coll_name);
500 key = &hc;
501 GNUNET_CRYPTO_hash (subsys_name, len_subsys_name, key);
502 GNUNET_free (subsys_name);
504 {
506 }
507 else
508 {
509 value_set = new_value_set (subsys, coll_name, num_nodes, is_persistent);
510 }
511 value_set->values[index_node] = value;
514 values,
515 key,
516 value_set,
518 return GNUNET_OK;
519}
520
521
527static void
528main_task (void *cls)
529{
530 unsigned index_node = *(unsigned *) cls;
531 const struct GNUNET_CONFIGURATION_Handle *cfg = nodes[index_node].conf;
532
533 if (set_value)
534 {
535 if (NULL == subsystem)
536 {
537 fprintf (stderr, "%s", _ ("Missing argument: subsystem \n"));
538 ret = 1;
539 return;
540 }
541 if (NULL == name)
542 {
543 fprintf (stderr, "%s", _ ("Missing argument: name\n"));
544 ret = 1;
545 return;
546 }
548 if (NULL == nodes[index_node].handle)
549 {
550 ret = 1;
551 return;
552 }
554 name,
555 (uint64_t) set_val,
556 persistent);
558 nodes[index_node].handle = NULL;
559 return;
560 }
561 if (NULL == (nodes[index_node].handle =
562 GNUNET_STATISTICS_create ("gnunet-statistics", cfg)))
563 {
564 ret = 1;
565 return;
566 }
567 if (GNUNET_NO == watch)
568 {
569 if (NULL == (nodes[index_node].gh =
571 subsystem,
572 name,
574 &collector,
575 &nodes[index_node].index_node)))
576 cleanup (nodes[index_node].handle, GNUNET_SYSERR);
577 }
578 else
579 {
580 if ((NULL == subsystem) || (NULL == name))
581 {
582 printf (_ ("No subsystem or name given\n"));
584 nodes[index_node].handle = NULL;
585 ret = 1;
586 return;
587 }
588 if (GNUNET_OK != GNUNET_STATISTICS_watch (nodes[index_node].handle,
589 subsystem,
590 name,
592 &nodes[index_node].index_node))
593 {
594 fprintf (stderr, _ ("Failed to initialize watch routine\n"));
595 nodes[index_node].shutdown_task =
596 GNUNET_SCHEDULER_add_now (&clean_node, &nodes[index_node].index_node);
597 return;
598 }
599 }
600 nodes[index_node].shutdown_task =
601 GNUNET_SCHEDULER_add_shutdown (&clean_node, &nodes[index_node].index_node);
602}
603
604
616static int
618 const char *filename)
619{
620 if (0 == strncmp (GNUNET_STRINGS_get_short_name (filename), "config", 6))
621 {
622 /* Found the config - stop iteration successfully */
626 if (GNUNET_OK !=
628 {
629 fprintf (stderr, "Failed loading config `%s'\n", filename);
630 return GNUNET_SYSERR;
631 }
632 return GNUNET_NO;
633 }
634 else
635 {
636 /* Continue iteration */
637 return GNUNET_OK;
638 }
639}
640
641
654static int
656 const char *filename)
657{
658 unsigned index_node;
659
660 GNUNET_assert (NULL != filename);
661 if (1 == sscanf (GNUNET_STRINGS_get_short_name (filename),
662 "%u",
663 &index_node))
664 {
667 NULL))
668 {
669 /* This is probably no directory for a testbed node
670 * Go on with iteration */
671 return GNUNET_OK;
672 }
673 return GNUNET_OK;
674 }
675 return GNUNET_OK;
676}
677
678
686static int
687discover_testbed_nodes (const char *path_testbed_discovered)
688{
689 int num_dir_entries;
690
691 num_dir_entries =
692 GNUNET_DISK_directory_scan (path_testbed_discovered,
694 NULL);
695 if (-1 == num_dir_entries)
696 {
697 fprintf (stderr,
698 "Failure during scanning directory `%s'\n",
699 path_testbed_discovered);
700 return -1;
701 }
702 return 0;
703}
704
705
714static void
715run (void *cls,
716 char *const *args,
717 const char *cfgfile,
718 const struct GNUNET_CONFIGURATION_Handle *cfg)
719{
721
722 c = (struct GNUNET_CONFIGURATION_Handle *) cfg;
724 if (NULL == csv_separator)
725 csv_separator = "";
726 if (NULL != args[0])
727 {
728 if (1 != sscanf (args[0], "%llu", &set_val))
729 {
730 fprintf (stderr, _ ("Invalid argument `%s'\n"), args[0]);
731 ret = 1;
732 return;
733 }
735 }
736 if (NULL != remote_host)
737 {
738 if (0 == remote_port)
739 {
740 if (GNUNET_SYSERR ==
742 "statistics",
743 "PORT",
744 &remote_port))
745 {
746 fprintf (stderr,
747 _ ("A port is required to connect to host `%s'\n"),
749 return;
750 }
751 }
752 else if (65535 <= remote_port)
753 {
754 fprintf (stderr,
755 _ (
756 "A port has to be between 1 and 65535 to connect to host `%s'\n"),
758 return;
759 }
760
761 /* Manipulate configuration */
763 "statistics",
764 "UNIXPATH",
765 "");
767 "statistics",
768 "HOSTNAME",
771 "statistics",
772 "PORT",
774 }
775 if (NULL == path_testbed)
776 {
779 nodes[0].index_node = 0;
780 nodes[0].conf = c;
781 GNUNET_SCHEDULER_add_now (&main_task, &nodes[0].index_node);
782 }
783 else
784 {
785 if (GNUNET_YES == watch)
786 {
787 printf (
788 _ ("Not able to watch testbed nodes (yet - feel free to implement)\n"));
789 ret = 1;
790 return;
791 }
794 {
795 return;
796 }
797 /* For each config/node collect statistics */
798 for (unsigned i = 0; i < num_nodes; i++)
799 {
800 GNUNET_SCHEDULER_add_now (&main_task, &nodes[i].index_node);
801 }
802 }
803}
804
805
813int
814main (int argc, char *const *argv)
815{
818 "name",
819 "NAME",
821 "limit output to statistics for the given NAME"),
822 &name),
824 "persistent",
826 "make the value being set persistent"),
827 &persistent),
829 "subsystem",
830 "SUBSYSTEM",
832 "limit output to the given SUBSYSTEM"),
833 &subsystem),
835 "csv-separator",
836 "CSV_SEPARATOR",
837 gettext_noop ("use as csv separator"),
840 "testbed",
841 "TESTBED",
843 "path to the folder containing the testbed data"),
844 &path_testbed),
846 "quiet",
848 "just print the statistics value"),
849 &quiet),
851 "watch",
852 gettext_noop ("watch value continuously"),
853 &watch),
855 "remote",
856 "REMOTE",
857 gettext_noop ("connect to remote host"),
858 &remote_host),
860 "port",
861 "PORT",
862 gettext_noop ("port for remote host"),
863 &remote_port),
865 };
866
867 remote_port = 0;
868 remote_host = NULL;
869 if (GNUNET_OK !=
871 &argc, &argv))
872 return 2;
873
874 ret = (GNUNET_OK ==
875 GNUNET_PROGRAM_run (argc,
876 argv,
877 "gnunet-statistics [options [value]]",
879 "Print statistics about GNUnet operations."),
880 options,
881 &run,
882 NULL))
883 ? ret
884 : 1;
886 num_nodes,
887 0);
889 GNUNET_free_nz ((void *) argv);
890 return ret;
891}
892
893
894/* end of gnunet-statistics.c */
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:74
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:98
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
struct GNUNET_HashCode key
The key used in the DHT.
static char * filename
struct GNUNET_SCHEDULER_Task * shutdown_task
static char * value
Value of the record to add/remove.
static unsigned long long set_val
Value to set.
static char * csv_separator_opt
Separator string for csv.
static int iter_check_config(void *cls, const char *filename)
Iter over content of a node's directory to check for existence of a config file.
static int persistent
Make the value that is being set persistent.
static int set_value
Set operation.
static char * path_testbed
The path of the testbed data.
static struct GNUNET_CONTAINER_MultiHashMap * values
Collection of all values (represented with ValueSet).
static int quiet
Quiet mode.
static void print_finish(void *cls)
Print and shutdown.
static char * name
Set to the specific stat value that we are after (or NULL for all).
static int printer_watch(void *cls, const char *subsys, const char *print_name, uint64_t value, int is_persistent)
Callback function to process statistic values.
static int discover_testbed_nodes(const char *path_testbed_discovered)
Count the number of nodes running in the testbed.
static int ret
Final status code.
static int num_nodes_ready
Number of nodes that have their values ready.
static struct Node * nodes
static const char * csv_separator
Separator string for csv.
static void continuation_print(void *cls, int success)
Called once all statistic values are available.
static void cleanup(void *cls, int success)
Function called last by the statistics code.
static void clean_node(void *cls)
Clean all data structures related to given node.
static int watch
Watch value continuously.
static int collector(void *cls, const char *subsys, const char *coll_name, uint64_t value, int is_persistent)
Iterate over statistics values and store them in values.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
int main(int argc, char *const *argv)
The main function to obtain statistics in GNUnet.
static char * remote_host
Remote host.
static int num_nodes_ready_shutdown
Number of nodes that have their values ready.
static int iter_testbed_path(void *cls, const char *filename)
Iterates over filenames in testbed directory.
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
static int printer(void *cls, const struct GNUNET_HashCode *key, void *value)
Print the (collected) values.
static unsigned num_nodes
Number of configurations of all (testbed) nodes.
static struct ValueSet * new_value_set(const char *subsys, const char *new_name, unsigned num_values, int is_persistent)
Create a new ValueSet.
static void main_task(void *cls)
Main task that does the actual work.
static unsigned long long remote_port
Remote host's port.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
API to create, modify and access statistics.
void GNUNET_CONFIGURATION_set_value_string(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value)
Set a configuration value that should be a string.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
void GNUNET_CONFIGURATION_set_value_number(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long number)
Set a configuration value that should be a number.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_load(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Load configuration.
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
Definition: disk.c:815
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_filename(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a filename (automatically path expanded).
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_ulong(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned long long *val)
Allow user to specify an unsigned long long.
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.
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.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#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.
#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
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:566
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:1338
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:979
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:1303
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for 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.
void GNUNET_STATISTICS_get_cancel(struct GNUNET_STATISTICS_GetHandle *gh)
Cancel a GNUNET_STATISTICS_get request.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
struct GNUNET_STATISTICS_GetHandle * GNUNET_STATISTICS_get(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Callback cont, GNUNET_STATISTICS_Iterator proc, void *cls)
Get statistic from the peer.
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).
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
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:1253
const char * GNUNET_STRINGS_get_short_name(const char *filename)
"man basename" Returns a pointer to a part of filename (allocates nothing)!
Definition: strings.c:663
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:111
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition: strings.c:640
Definition: conf.py:1
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
Internal representation of the hash map.
Definition of a command line option.
A 512-bit hashcode.
Entry in list of pending tasks.
Definition: scheduler.c:135
Linked list of things we still need to do.
void * cls
Closure for proc and cont.
Handle for the service.
Time for absolute times used by GNUnet, in microseconds.
Representation of all (testbed) nodes.
struct GNUNET_STATISTICS_GetHandle * gh
Handle for pending GET operation.
struct GNUNET_STATISTICS_Handle * handle
Statistics handle nodes.
struct GNUNET_CONFIGURATION_Handle * conf
Configuration handle for this node.
struct GNUNET_SCHEDULER_Task * shutdown_task
Identifier for shutdown task for this node.
unsigned index_node
Index of the node in this array.
Set of values for a combination of subsystem and name.
char * name
Name of the valueset.
int is_persistent
Persistence of the values.
char * subsystem
Subsystem of the valueset.
uint64_t * values
The values.