gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25782 - gnunet/src/sysmon


From: gnunet
Subject: [GNUnet-SVN] r25782 - gnunet/src/sysmon
Date: Mon, 14 Jan 2013 16:53:30 +0100

Author: wachs
Date: 2013-01-14 16:53:30 +0100 (Mon, 14 Jan 2013)
New Revision: 25782

Modified:
   gnunet/src/sysmon/gnunet-service-sysmon.c
   gnunet/src/sysmon/sysmon.conf.in
Log:
 changes


Modified: gnunet/src/sysmon/gnunet-service-sysmon.c
===================================================================
--- gnunet/src/sysmon/gnunet-service-sysmon.c   2013-01-14 15:39:53 UTC (rev 
25781)
+++ gnunet/src/sysmon/gnunet-service-sysmon.c   2013-01-14 15:53:30 UTC (rev 
25782)
@@ -30,6 +30,7 @@
 enum operation
 {
   o_internal,
+  o_ligbtop,
   o_command
 };
 
@@ -61,6 +62,9 @@
    */
   struct SysmonProperty *prev;
 
+       struct SysmonGtopProcProperty *gtop_proc_head;
+       struct SysmonGtopProcProperty *gtop_proc_tail;
+
   /**
    * Description used for statistics valuesd
    */
@@ -119,6 +123,17 @@
 };
 
 /**
+ * A system property to monitor
+ */
+struct SysmonGtopProcProperty
+{
+       struct SysmonGtopProcProperty *prev;
+       struct SysmonGtopProcProperty *next;
+       char * binary;
+};
+
+
+/**
  * Final status code.
  */
 static int ret;
@@ -142,6 +157,9 @@
 struct SysmonProperty *sp_head;
 struct SysmonProperty *sp_tail;
 
+struct SysmonGtopProcProperty *pp_head;
+struct SysmonGtopProcProperty *pp_tail;
+
 static void
 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
@@ -198,16 +216,15 @@
 {
   if (v_numeric ==sp->value_type)
   {
-      /* GNUNET_STATISTICS_set (stats, sp->desc, sp->num_val, GNUNET_NO); */
-
                fprintf (stderr, "%s : %s : %llu\n",
                                
GNUNET_STRINGS_absolute_time_to_string(GNUNET_TIME_absolute_get()),
                                sp->desc, (unsigned long long) sp->num_val);
   }
   else if (v_string ==sp->value_type)
   {
-      /* GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "NOT IMPLEMENTED\n"); */
-               fprintf (stderr, "SYSMON STRING\n");
+               fprintf (stderr, "%s : %s : %s\n",
+                               
GNUNET_STRINGS_absolute_time_to_string(GNUNET_TIME_absolute_get()),
+                               sp->desc, sp->str_val);
   }
   else
   {
@@ -289,6 +306,12 @@
 }
 
 static void
+exec_gtop_proc_mon (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  //struct SysmonGtopProcProperty *sp = cls;
+}
+
+static void
 load_property (void *cls,
                const char *section)
 {
@@ -478,7 +501,49 @@
   return GNUNET_OK;
 }
 
+static int
+load_gtop_properties (void)
+{
+       char *services;
+       char *s;
+       char *binary;
+       struct SysmonGtopProcProperty *pp;
+       int c;
+       /* Load network monitoring tasks */
 
+       /* Load service memory monitoring tasks */
+       if (GNUNET_NO == GNUNET_CONFIGURATION_have_value (cfg, "sysmon", 
"MONITOR_SERVICES"))
+               return GNUNET_OK;
+
+       if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, 
"sysmon", "MONITOR_SERVICES", &services))
+               return GNUNET_SYSERR;
+
+       s = strtok (services, " ");
+       c = 0;
+       while (NULL != s)
+       {
+               if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, s, 
"BINARY", &binary))
+               {
+                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Monitoring 
service `%s' with binary `%s'\n", s, binary);
+                       pp = GNUNET_malloc (sizeof (struct 
SysmonGtopProcProperty));
+                       pp->binary = binary;
+                       GNUNET_CONTAINER_DLL_insert (pp_head, pp_tail, pp);
+                       c++
+               }
+               s = strtok (NULL, " ");
+       }
+       GNUNET_free (services);
+
+       if (c > 0)
+       {
+
+       }
+
+       return GNUNET_OK;
+
+}
+
+
 static void
 run_property (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
@@ -525,7 +590,18 @@
 static void
 cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  /* FIXME: do clean up here */
+       struct SysmonGtopProcProperty *cur;
+       struct SysmonGtopProcProperty *next;
+
+       next = pp_head;
+       while (NULL != (cur = next))
+       {
+                       next = cur->next;
+                       GNUNET_CONTAINER_DLL_remove (pp_head, pp_tail, cur);
+                       GNUNET_free (cur->binary);
+                       GNUNET_free (cur);
+       }
+
 }
 
 
@@ -606,6 +682,13 @@
     return;
   }
 
+#if HAVE_LIBGTOP
+  if (GNUNET_SYSERR == load_gtop_properties ())
+  {
+         GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to load gtop properties 
\n");
+  }
+#endif
+
   /* run properties */
   if (GNUNET_SYSERR == run_properties ())
   {

Modified: gnunet/src/sysmon/sysmon.conf.in
===================================================================
--- gnunet/src/sysmon/sysmon.conf.in    2013-01-14 15:39:53 UTC (rev 25781)
+++ gnunet/src/sysmon/sysmon.conf.in    2013-01-14 15:53:30 UTC (rev 25782)
@@ -6,3 +6,4 @@
 BINARY = gnunet-daemon-sysmon
 CFGFILE = sysmon-properties.conf
 UNIXPATH = /tmp/gnunet-service-sysmon.sock
+MONITOR_SERVICES = fs transport
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]