summaryrefslogtreecommitdiff
path: root/examples/proclist.c
diff options
context:
space:
mode:
authorBenoît Dejean <bdejean@src.gnome.org>2005-12-12 13:23:54 +0000
committerBenoît Dejean <bdejean@src.gnome.org>2005-12-12 13:23:54 +0000
commit52fa57a39bf5d46cff7e0a53047bce5892eab85e (patch)
treee6b449fbcdff6f30bcab8777ad056c85415db846 /examples/proclist.c
parentaa5ac8fc10d5c04fbdf78145aa5d933685ec796d (diff)
downloadlibgtop-52fa57a39bf5d46cff7e0a53047bce5892eab85e.tar.gz
Added quick example for glibtop_get_proclist() and updated procmap example
* .cvsignore: * Makefile.am: * proclist.c: (main): * procmap.c: (main): Added quick example for glibtop_get_proclist() and updated procmap example to display smap.
Diffstat (limited to 'examples/proclist.c')
-rw-r--r--examples/proclist.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/proclist.c b/examples/proclist.c
new file mode 100644
index 00000000..209a5f5f
--- /dev/null
+++ b/examples/proclist.c
@@ -0,0 +1,28 @@
+#include <glibtop.h>
+#include <glibtop/proclist.h>
+
+#include <glib.h>
+
+#include <stdio.h>
+
+int main()
+{
+ unsigned *pids;
+ unsigned i;
+ glibtop_proclist buf;
+
+ glibtop_init();
+
+ pids = glibtop_get_proclist(&buf, 0, 0);
+
+ for (i = 0; i < buf.number; ++i)
+ printf("%u ", pids[i]);
+
+ putchar('\n');
+
+ g_free(pids);
+
+ glibtop_close();
+
+ return 0;
+}