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.
This commit is contained in:
28
examples/proclist.c
Normal file
28
examples/proclist.c
Normal file
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user