diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-01-14 15:09:30 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-01-14 15:09:30 +0000 |
commit | 1fa07892bdf78bc4b90bedfed4f32c89a5f11ef4 (patch) | |
tree | a5a497a1b8aa843222c6e2d078dcaa9b3c18cca1 | |
parent | 712fc3898a29fc0c83d7aa4390e2e91a6e2ea8a5 (diff) | |
download | gnunet-1fa07892bdf78bc4b90bedfed4f32c89a5f11ef4.tar.gz gnunet-1fa07892bdf78bc4b90bedfed4f32c89a5f11ef4.zip |
changes
-rw-r--r-- | src/sysmon/gnunet-service-sysmon.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/sysmon/gnunet-service-sysmon.c b/src/sysmon/gnunet-service-sysmon.c index 1aca36152..30ea30ac1 100644 --- a/src/sysmon/gnunet-service-sysmon.c +++ b/src/sysmon/gnunet-service-sysmon.c | |||
@@ -198,11 +198,16 @@ put_property (struct SysmonProperty *sp) | |||
198 | { | 198 | { |
199 | if (v_numeric ==sp->value_type) | 199 | if (v_numeric ==sp->value_type) |
200 | { | 200 | { |
201 | GNUNET_STATISTICS_set (stats, sp->desc, sp->num_val, GNUNET_NO); | 201 | /* GNUNET_STATISTICS_set (stats, sp->desc, sp->num_val, GNUNET_NO); */ |
202 | |||
203 | fprintf (stderr, "%s : %s : %llu\n", | ||
204 | GNUNET_STRINGS_absolute_time_to_string(GNUNET_TIME_absolute_get()), | ||
205 | sp->desc, (unsigned long long) sp->num_val); | ||
202 | } | 206 | } |
203 | else if (v_string ==sp->value_type) | 207 | else if (v_string ==sp->value_type) |
204 | { | 208 | { |
205 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "NOT IMPLEMENTED\n"); | 209 | /* GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "NOT IMPLEMENTED\n"); */ |
210 | fprintf (stderr, "SYSMON STRING\n"); | ||
206 | } | 211 | } |
207 | else | 212 | else |
208 | { | 213 | { |
@@ -215,8 +220,14 @@ put_property (struct SysmonProperty *sp) | |||
215 | static void | 220 | static void |
216 | update_uptime (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 221 | update_uptime (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
217 | { | 222 | { |
218 | struct SysmonProperty *sp = cls; | 223 | struct SysmonProperty *sp = cls; |
219 | sp->num_val ++; | 224 | static int first_run = GNUNET_YES; |
225 | |||
226 | if (GNUNET_YES == first_run) | ||
227 | first_run = GNUNET_NO; | ||
228 | else | ||
229 | sp->num_val += sp->interval.rel_value / 1000; | ||
230 | |||
220 | put_property (sp); | 231 | put_property (sp); |
221 | } | 232 | } |
222 | 233 | ||
@@ -402,7 +413,6 @@ load_default_properties (void) | |||
402 | 413 | ||
403 | /* GNUnet vcs revision */ | 414 | /* GNUnet vcs revision */ |
404 | unsigned int revision; | 415 | unsigned int revision; |
405 | return GNUNET_OK; | ||
406 | /* version */ | 416 | /* version */ |
407 | #ifdef VERSION | 417 | #ifdef VERSION |
408 | if (3 != sscanf (VERSION, "%u.%u.%u", &ver[0], &ver[1], &ver[2])) | 418 | if (3 != sscanf (VERSION, "%u.%u.%u", &ver[0], &ver[1], &ver[2])) |
@@ -426,7 +436,6 @@ return GNUNET_OK; | |||
426 | sp->value_type = v_numeric; | 436 | sp->value_type = v_numeric; |
427 | sp->num_val = 100 * ver[0] + 10 * ver[1] + ver[2]; | 437 | sp->num_val = 100 * ver[0] + 10 * ver[1] + ver[2]; |
428 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); | 438 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); |
429 | |||
430 | /* revision */ | 439 | /* revision */ |
431 | #ifdef VCS_VERSION | 440 | #ifdef VCS_VERSION |
432 | if (1 != sscanf (VCS_VERSION, "svn-%uM", &revision)) | 441 | if (1 != sscanf (VCS_VERSION, "svn-%uM", &revision)) |
@@ -439,7 +448,6 @@ return GNUNET_OK; | |||
439 | revision = 0; | 448 | revision = 0; |
440 | #endif | 449 | #endif |
441 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Revision: %u\n", revision); | 450 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Revision: %u\n", revision); |
442 | |||
443 | sp = GNUNET_malloc (sizeof (struct SysmonProperty)); | 451 | sp = GNUNET_malloc (sizeof (struct SysmonProperty)); |
444 | sp->desc = GNUNET_strdup ("GNUnet vcs revision"); | 452 | sp->desc = GNUNET_strdup ("GNUnet vcs revision"); |
445 | sp->type = t_static; | 453 | sp->type = t_static; |
@@ -457,17 +465,16 @@ return GNUNET_OK; | |||
457 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); | 465 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); |
458 | 466 | ||
459 | 467 | ||
460 | /* GNUnet sysmon daemon uptime */ | 468 | /* GNUnet sysmon daemon uptime in seconds */ |
461 | sp = GNUNET_malloc (sizeof (struct SysmonProperty)); | 469 | sp = GNUNET_malloc (sizeof (struct SysmonProperty)); |
462 | sp->desc = GNUNET_strdup ("GNUnet uptime"); | 470 | sp->desc = GNUNET_strdup ("GNUnet uptime"); |
463 | sp->type = t_continous; | 471 | sp->type = t_continous; |
464 | sp->value_type = v_numeric; | 472 | sp->value_type = v_numeric; |
465 | sp->num_val = (uint64_t) 0; | 473 | sp->num_val = (uint64_t) 0; |
466 | sp->interval = GNUNET_TIME_UNIT_SECONDS; | 474 | sp->interval = GNUNET_TIME_UNIT_MINUTES; |
467 | sp->task_id = GNUNET_SCHEDULER_NO_TASK; | 475 | sp->task_id = GNUNET_SCHEDULER_NO_TASK; |
468 | sp->task = update_uptime; | 476 | sp->task = update_uptime; |
469 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); | 477 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); |
470 | |||
471 | return GNUNET_OK; | 478 | return GNUNET_OK; |
472 | } | 479 | } |
473 | 480 | ||
@@ -607,7 +614,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
607 | ret = 1; | 614 | ret = 1; |
608 | return; | 615 | return; |
609 | } | 616 | } |
610 | |||
611 | } | 617 | } |
612 | 618 | ||
613 | 619 | ||