changes
[oweals/gnunet.git] / src / sysmon / test_glibtop.c
index b5deb8c5389394b6784b336dde0eac3738a6e4a6..e05a46bd2a18a5333720e838fb0c5c000d3f36e3 100644 (file)
 */
 
 /**
- * @file sysmon/test_glibtop.c
+ * @file sysmon/test_glibtop_process.c
  * @brief a brief test for glibtop
  * @author Matthias Wachs
  */
 
 #include "platform.h"
-
 #include <glibtop.h>
-#include <glibtop/proclist.h>
-#include <glibtop/procstate.h>
-#include <glibtop/procargs.h>
-#include <glibtop/procmem.h>
-#include <glib.h>
 
 static int ret;
 
-static void print_pids(guint64 which, guint64 arg)
-{
-    pid_t *pids = NULL;
-    unsigned i;
-    glibtop_proclist proc_list;
-    glibtop_proc_args proc_args;
-    glibtop_proc_mem proc_mem;
-    char *argss;
-
-    /* get process list */
-    pids = glibtop_get_proclist(&proc_list, which, arg);
-    if (NULL == pids)
-    {
-      fprintf (stderr, "Could not retrieve process list!\n");
-      ret = 1;
-      return;
-    }
-
-    printf("Found %lu processes\n", (unsigned long) proc_list.number);
-    for (i = 0; i < proc_list.number; ++i)
-    {
-        printf("PID %u:\n", pids[i]);
-
-        /* get process args */
-        argss = glibtop_get_proc_args (&proc_args, pids[i], 1024);
-        if (NULL == argss)
-        {
-          fprintf (stderr, "Could not retrieve process args!\n");
-          ret = 1;
-          return;
-        }
-        printf ("\targument string: %s\n", argss);
-        g_free (argss);
-
-        glibtop_get_proc_mem (&proc_mem, pids[i]);
-        printf ("\t%-50s: %lu\n", "total # of pages of memory", proc_mem.size);
-        printf ("\t%-50s: %lu\n", "number of pages of virtual memory",proc_mem.vsize);
-        printf ("\t%-50s: %lu\n", "number of resident set", proc_mem.resident);
-        printf ("\t%-50s: %lu\n", "number of pages of shared (mmap'd) memory", proc_mem.share);
-        printf ("\t%-50s: %lu\n", "resident set size", proc_mem.rss);
-    }
-
-    if (NULL != pids)
-    {
-      g_free(pids);
-      pids = NULL;
-    }
-}
-
 /**
  * The main function.
  *
@@ -100,12 +45,9 @@ main (int argc, char *const *argv)
     return 1;
   }
 
-  /* Print all processes */
-  print_pids(GLIBTOP_KERN_PROC_ALL, 0);
-
   glibtop_close();
   return ret;
 }
 
-/* end of test_glibtop.c */
+/* end of test_glibtop_process.c */