aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/statistics_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/statistics/statistics_api.c')
-rw-r--r--src/statistics/statistics_api.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c
index 7aa109930..cecc1b0f6 100644
--- a/src/statistics/statistics_api.c
+++ b/src/statistics/statistics_api.c
@@ -277,11 +277,11 @@ update_memory_statistics (struct GNUNET_STATISTICS_Handle *h)
277#if HAVE_MALLINFO 277#if HAVE_MALLINFO
278 { 278 {
279 struct mallinfo mi; 279 struct mallinfo mi;
280 280
281 mi = mallinfo(); 281 mi = mallinfo();
282 current_heap_size = mi.uordblks + mi.fordblks; 282 current_heap_size = mi.uordblks + mi.fordblks;
283 } 283 }
284#endif 284#endif
285#if HAVE_GETRUSAGE 285#if HAVE_GETRUSAGE
286 { 286 {
287 struct rusage ru; 287 struct rusage ru;
@@ -289,7 +289,7 @@ update_memory_statistics (struct GNUNET_STATISTICS_Handle *h)
289 if (0 == getrusage (RUSAGE_SELF, &ru)) 289 if (0 == getrusage (RUSAGE_SELF, &ru))
290 { 290 {
291 current_rss = 1024LL * ru.ru_maxrss; 291 current_rss = 1024LL * ru.ru_maxrss;
292 } 292 }
293 } 293 }
294#endif 294#endif
295 if (current_heap_size > h->peak_heap_size) 295 if (current_heap_size > h->peak_heap_size)
@@ -381,12 +381,12 @@ static void
381do_disconnect (struct GNUNET_STATISTICS_Handle *h) 381do_disconnect (struct GNUNET_STATISTICS_Handle *h)
382{ 382{
383 struct GNUNET_STATISTICS_GetHandle *c; 383 struct GNUNET_STATISTICS_GetHandle *c;
384 384
385 if (NULL != h->th) 385 if (NULL != h->th)
386 { 386 {
387 GNUNET_CLIENT_notify_transmit_ready_cancel (h->th); 387 GNUNET_CLIENT_notify_transmit_ready_cancel (h->th);
388 h->th = NULL; 388 h->th = NULL;
389 } 389 }
390 if (NULL != h->client) 390 if (NULL != h->client)
391 { 391 {
392 GNUNET_CLIENT_disconnect (h->client); 392 GNUNET_CLIENT_disconnect (h->client);
@@ -421,10 +421,10 @@ try_connect (struct GNUNET_STATISTICS_Handle *h)
421 return GNUNET_NO; 421 return GNUNET_NO;
422 if (NULL != h->client) 422 if (NULL != h->client)
423 return GNUNET_YES; 423 return GNUNET_YES;
424 h->client = GNUNET_CLIENT_connect ("statistics", h->cfg); 424 h->client = GNUNET_CLIENT_connect ("statistics", h->cfg);
425 if (NULL != h->client) 425 if (NULL != h->client)
426 { 426 {
427 gn = h->action_head; 427 gn = h->action_head;
428 while (NULL != (gh = gn)) 428 while (NULL != (gh = gn))
429 { 429 {
430 gn = gh->next; 430 gn = gh->next;
@@ -601,8 +601,8 @@ process_watch_value (struct GNUNET_STATISTICS_Handle *h,
601 return GNUNET_SYSERR; 601 return GNUNET_SYSERR;
602 } 602 }
603 w = h->watches[wid]; 603 w = h->watches[wid];
604 if (NULL == w) 604 if (NULL == w)
605 return GNUNET_NO; 605 return GNUNET_NO;
606 (void) w->proc (w->proc_cls, w->subsystem, w->name, 606 (void) w->proc (w->proc_cls, w->subsystem, w->name,
607 GNUNET_ntohll (wvm->value), 607 GNUNET_ntohll (wvm->value),
608 0 != (ntohl (wvm->flags) & GNUNET_STATISTICS_PERSIST_BIT)); 608 0 != (ntohl (wvm->flags) & GNUNET_STATISTICS_PERSIST_BIT));
@@ -674,7 +674,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg)
674 else 674 else
675 { 675 {
676 h->receiving = GNUNET_NO; 676 h->receiving = GNUNET_NO;
677 } 677 }
678 h->current = NULL; 678 h->current = NULL;
679 schedule_action (h); 679 schedule_action (h);
680 if (NULL != c->cont) 680 if (NULL != c->cont)
@@ -686,7 +686,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg)
686 { 686 {
687 do_disconnect (h); 687 do_disconnect (h);
688 reconnect_later (h); 688 reconnect_later (h);
689 return; 689 return;
690 } 690 }
691 /* finally, look for more! */ 691 /* finally, look for more! */
692 LOG (GNUNET_ERROR_TYPE_DEBUG, 692 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -697,12 +697,12 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg)
697 h->backoff = GNUNET_TIME_UNIT_MILLISECONDS; 697 h->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
698 return; 698 return;
699 case GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE: 699 case GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE:
700 if (GNUNET_OK != 700 if (GNUNET_OK !=
701 (ret = process_watch_value (h, msg))) 701 (ret = process_watch_value (h, msg)))
702 { 702 {
703 do_disconnect (h); 703 do_disconnect (h);
704 if (GNUNET_NO == ret) 704 if (GNUNET_NO == ret)
705 h->backoff = GNUNET_TIME_UNIT_MILLISECONDS; 705 h->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
706 reconnect_later (h); 706 reconnect_later (h);
707 return; 707 return;
708 } 708 }
@@ -710,7 +710,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg)
710 GNUNET_assert (h->watches_size > 0); 710 GNUNET_assert (h->watches_size > 0);
711 GNUNET_CLIENT_receive (h->client, &receive_stats, h, 711 GNUNET_CLIENT_receive (h->client, &receive_stats, h,
712 GNUNET_TIME_UNIT_FOREVER_REL); 712 GNUNET_TIME_UNIT_FOREVER_REL);
713 return; 713 return;
714 default: 714 default:
715 GNUNET_break (0); 715 GNUNET_break (0);
716 do_disconnect (h); 716 do_disconnect (h);
@@ -976,7 +976,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
976 h->current = NULL; 976 h->current = NULL;
977 } 977 }
978 } 978 }
979 next = h->action_head; 979 next = h->action_head;
980 while (NULL != (pos = next)) 980 while (NULL != (pos = next))
981 { 981 {
982 next = pos->next; 982 next = pos->next;
@@ -1018,7 +1018,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
1018 for (i = 0; i < h->watches_size; i++) 1018 for (i = 0; i < h->watches_size; i++)
1019 { 1019 {
1020 if (NULL == h->watches[i]) 1020 if (NULL == h->watches[i])
1021 continue; 1021 continue;
1022 GNUNET_free (h->watches[i]->subsystem); 1022 GNUNET_free (h->watches[i]->subsystem);
1023 GNUNET_free (h->watches[i]->name); 1023 GNUNET_free (h->watches[i]->name);
1024 GNUNET_free (h->watches[i]); 1024 GNUNET_free (h->watches[i]);
@@ -1232,7 +1232,7 @@ GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle,
1232 1232
1233 1233
1234/** 1234/**
1235 * Stop watching statistics from the peer. 1235 * Stop watching statistics from the peer.
1236 * 1236 *
1237 * @param handle identification of the statistics service 1237 * @param handle identification of the statistics service
1238 * @param subsystem limit to the specified subsystem, never NULL 1238 * @param subsystem limit to the specified subsystem, never NULL
@@ -1264,9 +1264,9 @@ GNUNET_STATISTICS_watch_cancel (struct GNUNET_STATISTICS_Handle *handle,
1264 GNUNET_free (w->name); 1264 GNUNET_free (w->name);
1265 GNUNET_free (w->subsystem); 1265 GNUNET_free (w->subsystem);
1266 GNUNET_free (w); 1266 GNUNET_free (w);
1267 handle->watches[i] = NULL; 1267 handle->watches[i] = NULL;
1268 return GNUNET_OK; 1268 return GNUNET_OK;
1269 } 1269 }
1270 } 1270 }
1271 return GNUNET_SYSERR; 1271 return GNUNET_SYSERR;
1272} 1272}
@@ -1305,7 +1305,7 @@ add_setter_action (struct GNUNET_STATISTICS_Handle *h, const char *name,
1305 for (ai = h->action_head; NULL != ai; ai = ai->next) 1305 for (ai = h->action_head; NULL != ai; ai = ai->next)
1306 { 1306 {
1307 if (! ( (0 == strcmp (ai->subsystem, h->subsystem)) && 1307 if (! ( (0 == strcmp (ai->subsystem, h->subsystem)) &&
1308 (0 == strcmp (ai->name, name)) && 1308 (0 == strcmp (ai->name, name)) &&
1309 ( (ACTION_UPDATE == ai->type) || 1309 ( (ACTION_UPDATE == ai->type) ||
1310 (ACTION_SET == ai->type) ) ) ) 1310 (ACTION_SET == ai->type) ) ) )
1311 continue; 1311 continue;
@@ -1351,7 +1351,7 @@ add_setter_action (struct GNUNET_STATISTICS_Handle *h, const char *name,
1351 } 1351 }
1352 ai->timeout = GNUNET_TIME_relative_to_absolute (SET_TRANSMIT_TIMEOUT); 1352 ai->timeout = GNUNET_TIME_relative_to_absolute (SET_TRANSMIT_TIMEOUT);
1353 ai->make_persistent = make_persistent; 1353 ai->make_persistent = make_persistent;
1354 return; 1354 return;
1355 } 1355 }
1356 /* no existing entry matches, create a fresh one */ 1356 /* no existing entry matches, create a fresh one */
1357 ai = GNUNET_malloc (sizeof (struct GNUNET_STATISTICS_GetHandle)); 1357 ai = GNUNET_malloc (sizeof (struct GNUNET_STATISTICS_GetHandle));