GNUnet  0.11.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 889 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().

891 {
892  struct GNUNET_STATISTICS_Handle *h;
893 
894  if (GNUNET_YES ==
896  "statistics",
897  "DISABLE"))
898  return NULL;
900  h->cfg = cfg;
903  return h;
904 }
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).
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
#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:99
struct GNUNET_TIME_Relative backoff
Time for next connect retry.
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
#define GNUNET_YES
Definition: gnunet_common.h:77
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 916 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(), 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().

918 {
919  struct GNUNET_STATISTICS_GetHandle *pos;
921 
922  if (NULL == h)
923  return;
924  GNUNET_assert (GNUNET_NO == h->do_destroy); /* Don't call twice. */
925  if ((sync_first) &&
926  (NULL != h->mq) &&
927  (0 != GNUNET_MQ_get_length (h->mq)))
928  {
929  if ((NULL != h->current) &&
930  (ACTION_GET == h->current->type))
931  h->current->aborted = GNUNET_YES;
932  next = h->action_head;
933  while (NULL != (pos = next))
934  {
935  next = pos->next;
936  if ((ACTION_GET == pos->type) ||
937  (ACTION_WATCH == pos->type))
938  {
940  h->action_tail,
941  pos);
942  free_action_item (pos);
943  }
944  }
945  h->do_destroy = GNUNET_YES;
946  schedule_action (h);
947  GNUNET_assert (NULL == h->destroy_task);
948  h->destroy_task
950  5),
951  &do_destroy,
952  h);
954  "Deferring destruction\n");
955  return; /* do not finish destruction just yet */
956  }
957  /* do clean up all */
959  "Cleaning all up\n");
960  while (NULL != (pos = h->action_head))
961  {
963  h->action_tail,
964  pos);
965  free_action_item (pos);
966  }
967  do_disconnect (h);
968  if (NULL != h->backoff_task)
969  {
971  h->backoff_task = NULL;
972  }
973  if (NULL != h->destroy_task)
974  {
975  GNUNET_break (0);
977  h->destroy_task = NULL;
978  }
979  for (unsigned int i = 0; i < h->watches_size; i++)
980  {
981  if (NULL == h->watches[i])
982  continue;
983  GNUNET_free (h->watches[i]->subsystem);
984  GNUNET_free (h->watches[i]->name);
985  GNUNET_free (h->watches[i]);
986  }
988  h->watches_size,
989  0);
990  GNUNET_free (h->subsystem);
991  GNUNET_free (h);
992 }
#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:78
#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:1253
#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:442
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:77
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:966
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 1154 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().

1159 {
1160  struct GNUNET_STATISTICS_WatchEntry *w;
1161 
1162  if (NULL == handle)
1163  return GNUNET_SYSERR;
1166  w->name = GNUNET_strdup (name);
1167  w->proc = proc;
1168  w->proc_cls = proc_cls;
1169  GNUNET_array_append (handle->watches,
1170  handle->watches_size,
1171  w);
1172  schedule_watch_request (handle,
1173  w);
1174  return GNUNET_OK;
1175 }
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:75
#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:76
#define GNUNET_array_append(arr, size, element)
Append an element to a list (growing the list by one).
const char * name
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 1189 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().

1194 {
1195  struct GNUNET_STATISTICS_WatchEntry *w;
1196 
1197  if (NULL == handle)
1198  return GNUNET_SYSERR;
1199  for (unsigned int i = 0; i < handle->watches_size; i++)
1200  {
1201  w = handle->watches[i];
1202  if (NULL == w)
1203  continue;
1204  if ((w->proc == proc) &&
1205  (w->proc_cls == proc_cls) &&
1206  (0 == strcmp (w->name,
1207  name)) &&
1208  (0 == strcmp (w->subsystem,
1209  subsystem)))
1210  {
1211  GNUNET_free (w->name);
1212  GNUNET_free (w->subsystem);
1213  GNUNET_free (w);
1214  handle->watches[i] = NULL;
1215  return GNUNET_OK;
1216  }
1217  }
1218  return GNUNET_SYSERR;
1219 }
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:75
GNUNET_STATISTICS_Iterator proc
Function to call.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
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 1077 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().

1083 {
1084  size_t slen1;
1085  size_t slen2;
1087 
1088  if (NULL == handle)
1089  return NULL;
1090  GNUNET_assert (NULL != proc);
1091  GNUNET_assert (GNUNET_NO == handle->do_destroy);
1092  if (NULL == subsystem)
1093  subsystem = "";
1094  if (NULL == name)
1095  name = "";
1096  slen1 = strlen (subsystem) + 1;
1097  slen2 = strlen (name) + 1;
1098  GNUNET_assert (slen1 + slen2 + sizeof(struct GNUNET_MessageHeader) <
1101  ai->sh = handle;
1103  ai->name = GNUNET_strdup (name);
1104  ai->cont = cont;
1105  ai->proc = proc;
1106  ai->cls = cls;
1107  ai->type = ACTION_GET;
1108  ai->msize = slen1 + slen2 + sizeof(struct GNUNET_MessageHeader);
1110  handle->action_tail,
1111  ai);
1112  schedule_action (handle);
1113  return ai;
1114 }
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:78
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.
#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.
const char * name
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 1124 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().

1125 {
1126  if (NULL == gh)
1127  return;
1128  gh->cont = NULL;
1129  if (gh->sh->current == gh)
1130  {
1131  gh->aborted = GNUNET_YES;
1132  return;
1133  }
1135  gh->sh->action_tail,
1136  gh);
1137  GNUNET_free (gh->name);
1138  GNUNET_free (gh->subsystem);
1139  GNUNET_free (gh);
1140 }
#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:77
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 1334 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().

1338 {
1339  if (NULL == handle)
1340  return;
1341  GNUNET_assert (GNUNET_NO == handle->do_destroy);
1342  add_setter_action (handle,
1343  name,
1344  make_persistent,
1345  value,
1346  ACTION_SET);
1347 }
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:78
static char * value
Value of the record to add/remove.
Set a value.
const char * name
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 1360 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_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().

1364 {
1365  if (NULL == handle)
1366  return;
1367  if (0 == delta)
1368  return;
1369  GNUNET_assert (GNUNET_NO == handle->do_destroy);
1370  add_setter_action (handle,
1371  name,
1372  make_persistent,
1373  (uint64_t) delta,
1374  ACTION_UPDATE);
1375 }
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:78
Update a value.
const char * name
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: