GNUnet  0.10.x
Macros | Typedefs | Functions
Statistics service

Track statistics or provide access to statistics. More...

Macros

#define GNUNET_STATISTICS_VERSION   0x00000000
 Version of the statistics API. More...
 

Typedefs

typedef int(* GNUNET_STATISTICS_Iterator) (void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
 Callback function to process statistic values. More...
 
typedef void(* GNUNET_STATISTICS_Callback) (void *cls, int success)
 Continuation called by GNUNET_STATISTICS_get() functions. More...
 

Functions

struct GNUNET_STATISTICS_HandleGNUNET_STATISTICS_create (const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Get handle for the statistics service. More...
 
void GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
 Destroy a handle (free all state associated with it). More...
 
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). More...
 
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. More...
 
struct GNUNET_STATISTICS_GetHandleGNUNET_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. More...
 
void GNUNET_STATISTICS_get_cancel (struct GNUNET_STATISTICS_GetHandle *gh)
 Cancel a GNUNET_STATISTICS_get request. More...
 
void GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
 Set statistic value for the peer. More...
 
void GNUNET_STATISTICS_update (struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
 Set statistic value for the peer. More...
 

Detailed Description

Track statistics or provide access to statistics.

Create, modify and access statistics about the operation of GNUnet.

All statistical values must be of type unsigned long long.

See also
Documentation

Macro Definition Documentation

◆ GNUNET_STATISTICS_VERSION

#define GNUNET_STATISTICS_VERSION   0x00000000

Version of the statistics API.

Definition at line 55 of file gnunet_statistics_service.h.

Typedef Documentation

◆ GNUNET_STATISTICS_Iterator

typedef int(* GNUNET_STATISTICS_Iterator) (void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)

Callback function to process statistic values.

Parameters
clsclosure
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 73 of file gnunet_statistics_service.h.

◆ GNUNET_STATISTICS_Callback

typedef void(* GNUNET_STATISTICS_Callback) (void *cls, int success)

Continuation called by GNUNET_STATISTICS_get() functions.

Parameters
clsclosure
successGNUNET_OK if statistics were successfully obtained, GNUNET_SYSERR if not.

Definition at line 148 of file gnunet_statistics_service.h.

Function Documentation

◆ GNUNET_STATISTICS_create()

struct GNUNET_STATISTICS_Handle* GNUNET_STATISTICS_create ( const char *  subsystem,
const struct GNUNET_CONFIGURATION_Handle cfg 
)

Get handle for the statistics service.

Parameters
subsystemname of subsystem using the service
cfgservices configuration in use
Returns
handle to use

Definition at line 894 of file statistics_api.c.

References GNUNET_STATISTICS_Handle::backoff, cfg, GNUNET_STATISTICS_Handle::cfg, GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_new, GNUNET_strdup, GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_YES, h, and GNUNET_STATISTICS_Handle::subsystem.

Referenced by GNUNET_ATS_solvers_solver_start(), GNUNET_DATACACHE_create(), GNUNET_DATASTORE_connect(), main_task(), RECLAIM_TICKETS_init(), run(), stat_connect_adapter(), statistics_ca(), and stats_ca().

896 {
897  struct GNUNET_STATISTICS_Handle *h;
898 
899  if (GNUNET_YES ==
901  "statistics",
902  "DISABLE"))
903  return NULL;
905  h->cfg = cfg;
908  return h;
909 }
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
char * subsystem
Name of our subsystem.
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Handle for the service.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:94
struct GNUNET_TIME_Relative backoff
Time for next connect retry.
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
#define GNUNET_YES
Definition: gnunet_common.h:80
int GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_STATISTICS_destroy()

void GNUNET_STATISTICS_destroy ( struct GNUNET_STATISTICS_Handle h,
int  sync_first 
)

Destroy a handle (free all state associated with it).

Parameters
hstatistics handle to destroy
sync_firstset to GNUNET_YES if pending SET requests should be completed

Definition at line 921 of file statistics_api.c.

References GNUNET_STATISTICS_GetHandle::aborted, ACTION_GET, GNUNET_STATISTICS_Handle::action_head, GNUNET_STATISTICS_Handle::action_tail, ACTION_WATCH, GNUNET_STATISTICS_Handle::backoff, GNUNET_STATISTICS_Handle::backoff_task, GNUNET_STATISTICS_Handle::current, GNUNET_STATISTICS_Handle::destroy_task, GNUNET_STATISTICS_Handle::do_destroy, do_destroy(), do_disconnect(), free_action_item(), GNUNET_array_grow, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_MQ_get_length(), GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_TIME_relative_multiply(), GNUNET_YES, GNUNET_STATISTICS_Handle::mq, GNUNET_STATISTICS_WatchEntry::name, GNUNET_STATISTICS_GetHandle::next, schedule_action(), GNUNET_STATISTICS_WatchEntry::subsystem, GNUNET_STATISTICS_Handle::subsystem, GNUNET_STATISTICS_GetHandle::type, GNUNET_STATISTICS_Handle::watches, and GNUNET_STATISTICS_Handle::watches_size.

Referenced by clean_node(), cleaning_task(), cleanup(), cleanup_task(), do_destroy(), do_shutdown(), final_cleanup(), GNUNET_ATS_solvers_solver_stop(), GNUNET_DATACACHE_destroy(), GNUNET_DATASTORE_disconnect(), handle_shutdown(), main_task(), mq_error_handler(), process_stat_done(), RECLAIM_TICKETS_deinit(), run(), shutdown_rest(), shutdown_task(), stat_disconnect_adapter(), statistics_da(), and stats_da().

923 {
924  struct GNUNET_STATISTICS_GetHandle *pos;
926 
927  if (NULL == h)
928  return;
929  GNUNET_assert (GNUNET_NO == h->do_destroy); /* Don't call twice. */
930  if ( (sync_first) &&
931  (NULL != h->mq) &&
932  (0 != GNUNET_MQ_get_length (h->mq)) )
933  {
934  if ( (NULL != h->current) &&
935  (ACTION_GET == h->current->type) )
936  h->current->aborted = GNUNET_YES;
937  next = h->action_head;
938  while (NULL != (pos = next))
939  {
940  next = pos->next;
941  if ( (ACTION_GET == pos->type) ||
942  (ACTION_WATCH == pos->type) )
943  {
945  h->action_tail,
946  pos);
947  free_action_item (pos);
948  }
949  }
950  h->do_destroy = GNUNET_YES;
951  schedule_action (h);
952  GNUNET_assert (NULL == h->destroy_task);
953  h->destroy_task
955  5),
956  &do_destroy,
957  h);
959  "Deferring destruction\n");
960  return; /* do not finish destruction just yet */
961  }
962  /* do clean up all */
964  "Cleaning all up\n");
965  while (NULL != (pos = h->action_head))
966  {
968  h->action_tail,
969  pos);
970  free_action_item (pos);
971  }
972  do_disconnect (h);
973  if (NULL != h->backoff_task)
974  {
976  h->backoff_task = NULL;
977  }
978  if (NULL != h->destroy_task)
979  {
980  GNUNET_break (0);
982  h->destroy_task = NULL;
983  }
984  for (unsigned int i = 0; i < h->watches_size; i++)
985  {
986  if (NULL == h->watches[i])
987  continue;
988  GNUNET_free (h->watches[i]->subsystem);
989  GNUNET_free (h->watches[i]->name);
990  GNUNET_free (h->watches[i]);
991  }
993  h->watches_size,
994  0);
995  GNUNET_free (h->subsystem);
996  GNUNET_free (h);
997 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
int do_destroy
Should this handle auto-destruct once all actions have been processed?
char * subsystem
Name of our subsystem.
struct GNUNET_STATISTICS_WatchEntry ** watches
Array of watch entries.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
enum ActionType type
Is this a ACTION_GET, ACTION_SET, ACTION_UPDATE or ACTION_WATCH?
static void do_disconnect(struct GNUNET_STATISTICS_Handle *h)
Disconnect from the statistics service.
char * name
What value is this action about? (never NULL)
Linked list of things we still need to do.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_TIME_Relative backoff
Time for next connect retry.
Watch a value.
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:1246
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
unsigned int GNUNET_MQ_get_length(struct GNUNET_MQ_Handle *mq)
Obtain the current length of the message queue.
Definition: mq.c:335
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:439
struct GNUNET_SCHEDULER_Task * backoff_task
Task doing exponential back-off trying to reconnect.
struct GNUNET_STATISTICS_GetHandle * action_tail
Tail of the linked list of actions (for fast append).
static void do_destroy(void *cls)
Task used to destroy the statistics handle.
struct GNUNET_SCHEDULER_Task * destroy_task
Task for running do_destroy().
struct GNUNET_MQ_Handle * mq
Message queue to the service.
Get a value.
static void schedule_action(void *cls)
Schedule the next action to be performed.
#define GNUNET_log(kind,...)
struct GNUNET_STATISTICS_GetHandle * current
Action we are currently busy with (action request has been transmitted, we&#39;re now receiving the respo...
unsigned int watches_size
Size of the watches array.
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_STATISTICS_GetHandle * next
This is a doubly linked list.
char * subsystem
What subsystem is this action about? (never NULL)
static void free_action_item(struct GNUNET_STATISTICS_GetHandle *gh)
Free memory associated with the given action item.
struct GNUNET_STATISTICS_GetHandle * action_head
Head of the linked list of pending actions (first action to be performed).
int aborted
Has the current iteration been aborted; for GET actions.
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_STATISTICS_watch()

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).

Parameters
handleidentification of the statistics service
subsystemlimit to the specified subsystem, never NULL
namename of the statistic value, never NULL
procfunction to call on each value
proc_clsclosure for proc
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Definition at line 1156 of file statistics_api.c.

References GNUNET_array_append, GNUNET_new, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, GNUNET_STATISTICS_WatchEntry::name, GNUNET_STATISTICS_WatchEntry::proc, GNUNET_STATISTICS_WatchEntry::proc_cls, schedule_watch_request(), GNUNET_STATISTICS_WatchEntry::subsystem, GNUNET_STATISTICS_Handle::watches, and GNUNET_STATISTICS_Handle::watches_size.

Referenced by main_task(), and stat_comp_cb().

1161 {
1162  struct GNUNET_STATISTICS_WatchEntry *w;
1163 
1164  if (NULL == handle)
1165  return GNUNET_SYSERR;
1168  w->name = GNUNET_strdup (name);
1169  w->proc = proc;
1170  w->proc_cls = proc_cls;
1171  GNUNET_array_append (handle->watches,
1172  handle->watches_size,
1173  w);
1174  schedule_watch_request (handle,
1175  w);
1176  return GNUNET_OK;
1177 }
static char * subsystem
Set to subsystem that we&#39;re going to get stats for (or NULL for all).
struct GNUNET_STATISTICS_WatchEntry ** watches
Array of watch entries.
void * proc_cls
Closure for proc.
char * name
What value is this action about? (never NULL)
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
GNUNET_STATISTICS_Iterator proc
Function to call.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
const char * name
#define GNUNET_array_append(arr, size, element)
Append an element to a list (growing the list by one).
static void schedule_watch_request(struct GNUNET_STATISTICS_Handle *h, struct GNUNET_STATISTICS_WatchEntry *watch)
Transmit request to service that we want to watch the development of a particular value...
unsigned int watches_size
Size of the watches array.
Entry kept for each value we are watching.
char * subsystem
What subsystem is this action about? (never NULL)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_STATISTICS_watch_cancel()

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.

Parameters
handleidentification of the statistics service
subsystemlimit to the specified subsystem, never NULL
namename of the statistic value, never NULL
procfunction to call on each value
proc_clsclosure for proc
Returns
GNUNET_OK on success, GNUNET_SYSERR on error (no such watch)

Definition at line 1191 of file statistics_api.c.

References GNUNET_free, GNUNET_OK, GNUNET_SYSERR, GNUNET_STATISTICS_WatchEntry::name, GNUNET_STATISTICS_WatchEntry::proc, GNUNET_STATISTICS_WatchEntry::proc_cls, GNUNET_STATISTICS_WatchEntry::subsystem, GNUNET_STATISTICS_Handle::watches, and GNUNET_STATISTICS_Handle::watches_size.

Referenced by clean_node(), and stat_disconnect_adapter().

1196 {
1197  struct GNUNET_STATISTICS_WatchEntry *w;
1198 
1199  if (NULL == handle)
1200  return GNUNET_SYSERR;
1201  for (unsigned int i=0;i<handle->watches_size;i++)
1202  {
1203  w = handle->watches[i];
1204  if (NULL == w)
1205  continue;
1206  if ( (w->proc == proc) &&
1207  (w->proc_cls == proc_cls) &&
1208  (0 == strcmp (w->name,
1209  name)) &&
1210  (0 == strcmp (w->subsystem,
1211  subsystem)) )
1212  {
1213  GNUNET_free (w->name);
1214  GNUNET_free (w->subsystem);
1215  GNUNET_free (w);
1216  handle->watches[i] = NULL;
1217  return GNUNET_OK;
1218  }
1219  }
1220  return GNUNET_SYSERR;
1221 }
static char * subsystem
Set to subsystem that we&#39;re going to get stats for (or NULL for all).
struct GNUNET_STATISTICS_WatchEntry ** watches
Array of watch entries.
void * proc_cls
Closure for proc.
char * name
What value is this action about? (never NULL)
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
GNUNET_STATISTICS_Iterator proc
Function to call.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
const char * name
unsigned int watches_size
Size of the watches array.
Entry kept for each value we are watching.
char * subsystem
What subsystem is this action about? (never NULL)
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_STATISTICS_get()

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.

Parameters
handleidentification of the statistics service
subsystemlimit to the specified subsystem, NULL for all subsystems
namename of the statistic value, NULL for all values
contcontinuation to call when done (can be NULL) This callback CANNOT destroy the statistics handle in the same call.
procfunction to call on each value
clsclosure for proc and cont
Returns
NULL on error
Parameters
handleidentification of the statistics service
subsystemlimit to the specified subsystem, NULL for our subsystem
namename of the statistic value, NULL for all values
contcontinuation to call when done (can be NULL) This callback CANNOT destroy the statistics handle in the same call.
procfunction to call on each value
clsclosure for cont and proc
Returns
NULL on error

Definition at line 1079 of file statistics_api.c.

References ACTION_GET, GNUNET_STATISTICS_Handle::action_head, GNUNET_STATISTICS_Handle::action_tail, ai, GNUNET_STATISTICS_GetHandle::cls, GNUNET_STATISTICS_GetHandle::cont, GNUNET_STATISTICS_Handle::do_destroy, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_MAX_MESSAGE_SIZE, GNUNET_new, GNUNET_NO, GNUNET_strdup, handle, GNUNET_STATISTICS_GetHandle::msize, GNUNET_STATISTICS_GetHandle::name, GNUNET_STATISTICS_WatchEntry::proc, GNUNET_STATISTICS_GetHandle::proc, schedule_action(), GNUNET_STATISTICS_GetHandle::sh, GNUNET_STATISTICS_GetHandle::subsystem, and GNUNET_STATISTICS_GetHandle::type.

Referenced by check_all_done(), GNUNET_HOSTLIST_client_start(), main_task(), post_profiler(), run(), service_connect_comp(), and stats_connect_cb().

1085 {
1086  size_t slen1;
1087  size_t slen2;
1089 
1090  if (NULL == handle)
1091  return NULL;
1092  GNUNET_assert (NULL != proc);
1093  GNUNET_assert (GNUNET_NO == handle->do_destroy);
1094  if (NULL == subsystem)
1095  subsystem = "";
1096  if (NULL == name)
1097  name = "";
1098  slen1 = strlen (subsystem) + 1;
1099  slen2 = strlen (name) + 1;
1100  GNUNET_assert (slen1 + slen2 + sizeof (struct GNUNET_MessageHeader) <
1103  ai->sh = handle;
1105  ai->name = GNUNET_strdup (name);
1106  ai->cont = cont;
1107  ai->proc = proc;
1108  ai->cls = cls;
1109  ai->type = ACTION_GET;
1110  ai->msize = slen1 + slen2 + sizeof (struct GNUNET_MessageHeader);
1112  handle->action_tail,
1113  ai);
1114  schedule_action (handle);
1115  return ai;
1116 }
int do_destroy
Should this handle auto-destruct once all actions have been processed?
char * name
What value is this action about? (can be NULL)
static char * subsystem
Set to subsystem that we&#39;re going to get stats for (or NULL for all).
GNUNET_STATISTICS_Iterator proc
Function to call (for GET actions only).
char * subsystem
What subsystem is this action about? (can be NULL)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
enum ActionType type
Is this a ACTION_GET, ACTION_SET, ACTION_UPDATE or ACTION_WATCH?
Linked list of things we still need to do.
#define GNUNET_NO
Definition: gnunet_common.h:81
uint16_t msize
Size of the message that we will be transmitting.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_STATISTICS_GetHandle * action_tail
Tail of the linked list of actions (for fast append).
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
const char * name
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
GNUNET_STATISTICS_Callback cont
Continuation to call once action is complete.
struct GNUNET_STATISTICS_Handle * sh
Main statistics handle.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
Get a value.
static void schedule_action(void *cls)
Schedule the next action to be performed.
void * cls
Closure for proc and cont.
Header for all communications.
struct GNUNET_STATISTICS_GetHandle * action_head
Head of the linked list of pending actions (first action to be performed).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_STATISTICS_get_cancel()

void GNUNET_STATISTICS_get_cancel ( struct GNUNET_STATISTICS_GetHandle gh)

Cancel a GNUNET_STATISTICS_get request.

Must be called before the 'cont' function is called.

Parameters
ghhandle of the request to cancel

Cancel a GNUNET_STATISTICS_get request.

Must be called before the 'cont' function is called.

Parameters
ghhandle of the request to cancel

Definition at line 1126 of file statistics_api.c.

References GNUNET_STATISTICS_GetHandle::aborted, GNUNET_STATISTICS_Handle::action_head, GNUNET_STATISTICS_Handle::action_tail, GNUNET_STATISTICS_GetHandle::cont, GNUNET_STATISTICS_Handle::current, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_YES, GNUNET_STATISTICS_GetHandle::name, GNUNET_STATISTICS_GetHandle::sh, and GNUNET_STATISTICS_GetHandle::subsystem.

Referenced by clean_node(), clean_peer(), cleaning_task(), GNUNET_HOSTLIST_client_stop(), stat_timeout(), stat_timeout_task(), and statistics_da().

1127 {
1128  if (NULL == gh)
1129  return;
1130  gh->cont = NULL;
1131  if (gh->sh->current == gh)
1132  {
1133  gh->aborted = GNUNET_YES;
1134  return;
1135  }
1137  gh->sh->action_tail,
1138  gh);
1139  GNUNET_free (gh->name);
1140  GNUNET_free (gh->subsystem);
1141  GNUNET_free (gh);
1142 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
char * name
What value is this action about? (can be NULL)
char * subsystem
What subsystem is this action about? (can be NULL)
struct GNUNET_STATISTICS_GetHandle * action_tail
Tail of the linked list of actions (for fast append).
GNUNET_STATISTICS_Callback cont
Continuation to call once action is complete.
struct GNUNET_STATISTICS_Handle * sh
Main statistics handle.
struct GNUNET_STATISTICS_GetHandle * current
Action we are currently busy with (action request has been transmitted, we&#39;re now receiving the respo...
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_STATISTICS_GetHandle * action_head
Head of the linked list of pending actions (first action to be performed).
int aborted
Has the current iteration been aborted; for GET actions.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_STATISTICS_set()

void GNUNET_STATISTICS_set ( struct GNUNET_STATISTICS_Handle handle,
const char *  name,
uint64_t  value,
int  make_persistent 
)

Set statistic value for the peer.

Will always use our subsystem (the argument used when handle was created).

Parameters
handleidentification of the statistics service
namename of the statistic value
valuenew value to set
make_persistentshould the value be kept across restarts?

Will always use our subsystem (the argument used when "handle" was created).

Parameters
handleidentification of the statistics service
namename of the statistic value
valuenew value to set
make_persistentshould the value be kept across restarts?

Definition at line 1336 of file statistics_api.c.

References ACTION_SET, add_setter_action(), GNUNET_STATISTICS_Handle::do_destroy, GNUNET_assert, and GNUNET_NO.

Referenced by adapt_sizes(), add_peer_array_to_set(), add_valid_peer(), boot_queue(), calculate_put_interval(), check_zone_namestore_next(), cleanup_validation_entry(), client_connect(), client_delete_session(), client_disconnect_cb(), client_run(), commit_set(), connect_notify(), create_peer_ctx(), destroy_peer(), destroy_route(), dir_ready_cb(), discard_buffer(), disconnect_notify(), do_round(), finish_response(), GSC_SESSIONS_create(), GSC_SESSIONS_end(), GSF_peer_connect_handler(), GSF_peer_disconnect_handler(), GSF_plan_notify_peer_disconnect_(), GSF_plan_notify_request_done_(), GST_neighbours_send(), GST_validation_handle_pong(), GST_validation_start(), handle_connection_create(), handle_p2p_estimate(), handle_put(), handle_release_reserve(), handle_reserve(), insert_hostlist(), insert_in_sampler(), insert_in_view(), iterate_zones(), kce_generate(), LIBGNUNET_PLUGIN_TRANSPORT_INIT(), libgnunet_plugin_transport_tcp_init(), load_hostlist_file(), main_task(), mq_init(), new_sub(), plan(), process_result(), process_stdin(), publish_p2a_stat_update(), publish_ve_stat_update(), queue_destroy(), receiver_destroy(), route_message(), run(), run_zone_iteration_round(), save_hostlist_file(), schedule_peer_transmission(), secret_destroy(), sender_destroy(), set_state_and_timeout(), setup_estimate_message(), setup_queue(), setup_sender(), store_completed_cb(), sync_stats(), task_check(), transmit_ping_if_allowed(), transmit_send_continuation(), try_transmission(), udp_disconnect_session(), udp_plugin_create_session(), unix_plugin_do_write(), unix_plugin_get_session(), unix_plugin_send(), unix_plugin_session_disconnect(), update_addresses_stat(), update_latencies(), update_memory_statistics(), update_velocity(), and zone_iteration_finished().

1340 {
1341  if (NULL == handle)
1342  return;
1343  GNUNET_assert (GNUNET_NO == handle->do_destroy);
1344  add_setter_action (handle,
1345  name,
1346  make_persistent,
1347  value,
1348  ACTION_SET);
1349 }
int do_destroy
Should this handle auto-destruct once all actions have been processed?
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_NO
Definition: gnunet_common.h:81
static char * value
Value of the record to add/remove.
const char * name
Set a value.
static void add_setter_action(struct GNUNET_STATISTICS_Handle *h, const char *name, int make_persistent, uint64_t value, enum ActionType type)
Queue a request to change a statistic.
Here is the call graph for this function:

◆ GNUNET_STATISTICS_update()

void GNUNET_STATISTICS_update ( struct GNUNET_STATISTICS_Handle handle,
const char *  name,
int64_t  delta,
int  make_persistent 
)

Set statistic value for the peer.

Will always use our subsystem (the argument used when handle was created).

Parameters
handleidentification of the statistics service
namename of the statistic value
deltachange in value (added to existing value)
make_persistentshould the value be kept across restarts?

Will always use our subsystem (the argument used when "handle" was created).

Parameters
handleidentification of the statistics service
namename of the statistic value
deltachange in value (added to existing value)
make_persistentshould the value be kept across restarts?

Definition at line 1362 of file statistics_api.c.

References ACTION_UPDATE, add_setter_action(), GNUNET_STATISTICS_Handle::do_destroy, GNUNET_assert, and GNUNET_NO.

Referenced by access_handler_callback(), ack_message_sent(), ack_proc(), add_host_to_known_hosts(), add_revocation(), address_decrement_active(), adv_transmit(), announce_id(), ats_request_address_change(), attempt_connect(), backtalker_monotime_cb(), blacklist_check(), bound_priority(), broadcast_mst_cb(), broadcast_my_type_map(), cadet_reply_proc(), callback_download(), check_has_addr(), check_peer_online(), check_peer_pull_reply(), check_tcp_data(), clean_request(), client_connect_cb(), client_disconnect_cb(), client_receive_mst_cb(), client_request_destroy(), client_response_handler(), client_send_cb(), commit_set(), confirm_or_drop_neighbour(), connect_cb(), connect_notify(), consider_peer_for_forwarding(), consider_request_for_forwarding(), core_read_finished_cb(), create_channel_to_destination(), create_macendpoint(), create_session(), datacache_get_iterator(), decode_and_send(), decrypt_box(), deliver_message(), dequeue(), destroy_direction(), destroy_peer(), dht_get_string_accept_handler(), discard_all_from_rung_tail(), disconnect_cb(), disconnect_notify(), dns_post_request_handler(), dns_pre_request_handler(), do_decrypt(), do_encrypt(), do_round(), do_transmit(), download_hostlist(), enqueue(), env_delete_notify(), expire_oldest_entry(), expired_processor(), fail_intersection_operation(), finish_request(), forward_reply(), fragmented_message_done(), free_channel_state(), free_destination_entry(), free_fragment_message(), free_macendpoint(), free_pending_request(), free_queue(), GAS_handle_address_add(), GAS_handle_address_destroyed(), GAS_handle_address_update(), GAS_handle_preference_change(), GAS_handle_reservation_request(), GAS_mlp_address_change_preference(), GAS_performance_notify_all_clients(), GAS_proportional_address_add(), GAS_proportional_address_delete(), GAS_scheduling_transmit_address_suggestion(), GCC_latency_observed(), GCCH_channel_incoming_new(), GCCH_channel_local_new(), GCCH_handle_channel_open_ack(), GCCH_handle_channel_plaintext_data(), GCCH_handle_channel_plaintext_data_ack(), GCD_search(), GCT_handle_encrypted(), GCT_handle_kx(), GCT_handle_kx_auth(), GCT_send(), GDS_CLIENTS_handle_reply(), GDS_DATACACHE_handle_get(), GDS_DATACACHE_handle_put(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), GDS_NEIGHBOURS_handle_reply(), GDS_ROUTING_add(), get_forward_count(), get_randomized_delay(), GNUNET_DATACACHE_get(), GNUNET_DATACACHE_get_closest(), GNUNET_DATACACHE_get_random(), GNUNET_DATACACHE_put(), GNUNET_DATASTORE_get_for_replication(), GNUNET_DATASTORE_get_key(), GNUNET_DATASTORE_get_zero_anonymity(), GNUNET_DATASTORE_put(), GNUNET_DATASTORE_release_reserve(), GNUNET_DATASTORE_remove(), GNUNET_DATASTORE_reserve(), GNUNET_DEFRAGMENT_process_fragment(), GNUNET_FRAGMENT_context_create(), GNUNET_FRAGMENT_process_ack(), GNUNET_FS_handle_on_demand_block(), got_peer(), GSC_CLIENTS_deliver_message(), GSC_SESSIONS_confirm_typemap(), GSC_TYPEMAP_get_from_message(), GSF_block_peer_migration_(), GSF_local_lookup_(), GSF_pending_request_create_(), GSF_plan_add_(), GST_blacklist_test_allowed(), GST_neighbours_calculate_receive_delay(), GST_neighbours_force_disconnect(), GST_neighbours_handle_disconnect_message(), GST_neighbours_handle_quota_message(), GST_neighbours_handle_session_ack(), GST_neighbours_handle_session_syn(), GST_neighbours_handle_session_syn_ack(), GST_neighbours_keepalive(), GST_neighbours_keepalive_response(), GST_receive_callback(), GST_validation_handle_ping(), GST_validation_handle_pong(), handle_backchannel_encapsulation(), handle_block_cache(), handle_client_recv_ok(), handle_client_redirect_to_ip(), handle_client_response(), handle_client_send(), handle_client_send_request(), handle_client_start_search(), handle_core_connect(), handle_core_disconnect(), handle_data(), handle_datastore_reply(), handle_dht_local_get(), handle_dht_local_get_stop(), handle_dht_local_put(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_dht_reply(), handle_dns_response(), handle_dv_box(), handle_dv_learn(), handle_encrypted(), handle_ephemeral_key(), handle_feedback(), handle_find_peer(), handle_flow_control(), handle_get(), handle_get_key(), handle_get_replication(), handle_get_zero_anonymity(), handle_hello(), handle_helper_message(), handle_icmp_back(), handle_icmp_remote(), handle_icmp_service(), handle_iteration_next(), handle_local_data(), handle_lookup(), handle_lookup_block(), handle_lookup_block_it(), handle_monitor_error(), handle_monitor_event(), handle_p2p_estimate(), handle_p2p_get(), handle_p2p_migration_stop(), handle_p2p_put(), handle_p2p_reply(), handle_peer_check(), handle_peer_pull_reply(), handle_peer_pull_request(), handle_peer_push(), handle_ping(), handle_plaintext_keepalive(), handle_pong(), handle_queue_create_fail(), handle_queue_create_ok(), handle_raw_message(), handle_record_store(), handle_reliability_ack(), handle_remove(), handle_reply(), handle_request(), handle_send_message_ack(), handle_status(), handle_tcp_back(), handle_tcp_data(), handle_tcp_nat_probe(), handle_tcp_remote(), handle_tcp_service(), handle_tcp_welcome(), handle_transport_notify_connect(), handle_transport_notify_disconnect(), handle_udp_back(), handle_udp_remote(), handle_udp_service(), handle_union_p2p_demand(), handle_union_p2p_elements(), handle_union_p2p_full_element(), handle_union_p2p_strata_estimator(), handle_validation_response(), handler_connect(), handler_disconnect(), host_processor(), http_client_plugin_send(), http_server_plugin_send(), icmp_from_helper(), insert_in_sampler(), iterate_zones(), learn_dv_path(), lookup_authz_cb(), make_queue_entry(), merge_pr(), message_token(), monitor_iterate_cb(), mq_notify_sent_cb(), new_channel(), new_service_channel(), next_phase(), no_more_local_results(), ns_lookup_result_cb(), pass_plaintext_to_core(), peerstore_store_validation_cb(), perform_dht_put(), plugin_env_address_change_notification(), process(), process_data(), process_dns_result(), process_hello(), process_helper_messages(), process_local_reply(), process_parallel_lookup_result(), process_payload(), process_record(), process_reply(), process_result(), progress_cb(), publish_zone_dht_start(), put_continuation(), put_migration_continuation(), qc_fragment_sent(), qc_message_sent(), quota_processor(), read_friends_file(), read_process_fragment(), reannounce_regex(), receive_complete_cb(), refresh_block(), refresh_hello_task(), regex_edge_iterator(), regex_iterator(), regex_next_edge(), regex_result_iterator(), remove_continuation(), remove_timeout_messages_and_select(), request_done(), revalidate_address(), route_control_message_without_fc(), route_message(), route_packet(), route_via_neighbour(), schedule_current_round(), schedule_next_hello(), schedule_peer_transmission(), schedule_transmit_on_queue(), secret_destroy(), select_peer(), select_write_cb(), send_ack(), send_bloomfilter(), send_client_done(), send_client_done_and_destroy(), send_client_removed_element(), send_disconnect(), send_find_peer_message(), send_hello_beacon(), send_ibf(), send_icmp_packet_via_tun(), send_keep_alive(), send_keepalive(), send_kx(), send_kx_auth(), send_lookup_response(), send_packet_to_cadet_channel(), send_ping(), send_pull_reply(), send_pull_request(), send_push(), send_session_syn_cont(), send_store_response(), send_syn(), send_syn_ack_message(), send_tcp_packet_via_tun(), send_to_channel(), send_udp_packet_via_tun(), server_receive_mst_cb(), server_send_callback(), session_disconnect_it(), set_alternative_address(), set_incoming_quota(), setup_shared_secret_enc(), sock_read(), start_local_query(), suggest_to_connect(), switch_address_bl_check_cont(), tcp_plugin_disconnect_session(), tcp_plugin_get_session(), tcp_plugin_send(), test_exist_cb(), test_put_load_too_high(), timeout_hello_validation(), timeout_request(), tokenized_cb(), transmit_fragment(), transmit_item(), transmit_next(), transmit_ping_if_allowed(), transmit_request(), transmit_send_continuation(), transmit_task_cb(), transmit_typemap_task(), try_decrypt(), try_reconnect(), try_transmission_to_peer(), udp_plugin_send(), udp_select_read(), udp_select_send(), unicast(), union_accept(), union_evaluate(), unix_demultiplexer(), unix_plugin_do_write(), update_active_address(), update_ax_by_kx(), update_hostlist(), update_network_size_estimate(), vpn_allocation_callback(), wlan_data_message_handler(), wlan_plugin_disconnect_session(), and wlan_plugin_send().

1366 {
1367  if (NULL == handle)
1368  return;
1369  if (0 == delta)
1370  return;
1371  GNUNET_assert (GNUNET_NO == handle->do_destroy);
1372  add_setter_action (handle,
1373  name,
1374  make_persistent,
1375  (uint64_t) delta,
1376  ACTION_UPDATE);
1377 }
int do_destroy
Should this handle auto-destruct once all actions have been processed?
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_NO
Definition: gnunet_common.h:81
const char * name
Update a value.
static void add_setter_action(struct GNUNET_STATISTICS_Handle *h, const char *name, int make_persistent, uint64_t value, enum ActionType type)
Queue a request to change a statistic.
Here is the call graph for this function: