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:
@@ -18,6 +18,7 @@ pprint
|
|||||||
pprint_static
|
pprint_static
|
||||||
procargs
|
procargs
|
||||||
procargs_static
|
procargs_static
|
||||||
|
proclist
|
||||||
df
|
df
|
||||||
df_static
|
df_static
|
||||||
netlist
|
netlist
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
2005-12-12 Benoît Dejean <benoit@placenet.org>
|
||||||
|
|
||||||
|
* .cvsignore:
|
||||||
|
* Makefile.am:
|
||||||
|
* proclist.c: (main):
|
||||||
|
* procmap.c: (main):
|
||||||
|
|
||||||
|
Added quick example for glibtop_get_proclist()
|
||||||
|
and updated procmap example to display smap.
|
||||||
|
|
||||||
2005-08-02 Benoît Dejean <TazForEver@dlfp.org>
|
2005-08-02 Benoît Dejean <TazForEver@dlfp.org>
|
||||||
|
|
||||||
* pprint.c: (pprint_get_cpu), (pprint_get_loadavg),
|
* pprint.c: (pprint_get_cpu), (pprint_get_loadavg),
|
||||||
|
@@ -8,7 +8,7 @@ DEFS = @DEFS@
|
|||||||
|
|
||||||
noinst_PROGRAMS = first second pprint procargs df netlist \
|
noinst_PROGRAMS = first second pprint procargs df netlist \
|
||||||
mountlist procmap netload sysdeps timings \
|
mountlist procmap netload sysdeps timings \
|
||||||
openfiles smp
|
openfiles smp proclist
|
||||||
|
|
||||||
first_SOURCES = first.c
|
first_SOURCES = first.c
|
||||||
first_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
first_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
||||||
@@ -48,3 +48,6 @@ netlist_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
|||||||
|
|
||||||
openfiles_SOURCES = openfiles.c
|
openfiles_SOURCES = openfiles.c
|
||||||
openfiles_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
openfiles_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
||||||
|
|
||||||
|
proclist_SOURCES = proclist.c
|
||||||
|
proclist_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
||||||
|
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;
|
||||||
|
}
|
@@ -157,6 +157,18 @@ main (int argc, char *argv [])
|
|||||||
perm);
|
perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
g_print("smaps flags:%#llx size:%llu rss:%llu "
|
||||||
|
"shared_clean:%llu shared_dirty:%llu "
|
||||||
|
"private_clean:%llu private_dirty: %llu\n",
|
||||||
|
maps[i].flags,
|
||||||
|
maps[i].size >> 10,
|
||||||
|
maps[i].rss >> 10,
|
||||||
|
maps[i].shared_clean >> 10,
|
||||||
|
maps[i].shared_dirty >> 10,
|
||||||
|
maps[i].private_clean >> 10,
|
||||||
|
maps[i].private_dirty >> 10);
|
||||||
|
|
||||||
if (filename && (filename != maps [i].filename))
|
if (filename && (filename != maps [i].filename))
|
||||||
g_free ((void*)filename);
|
g_free ((void*)filename);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user