Fixed wd and new simple mem example.

2007-05-19  Benoît Dejean  <benoit@placenet.org>

	* Makefile.am:
	* mem.c: (main):
	* wd.c: (main):

	Fixed wd and new simple mem example.

svn path=/trunk/; revision=2593
This commit is contained in:
Benoît Dejean
2007-05-19 14:26:11 +00:00
committed by Benoît Dejean
parent 0e2fe6158c
commit b1acd4461e
4 changed files with 41 additions and 1 deletions

View File

@@ -1,3 +1,11 @@
2007-05-19 Benoît Dejean <benoit@placenet.org>
* Makefile.am:
* mem.c: (main):
* wd.c: (main):
Fixed wd and new simple mem example.
2006-02-27 Benoît Dejean <benoit@placenet.org> 2006-02-27 Benoît Dejean <benoit@placenet.org>
* pprint.c: (pprint_get_proc_mem), (main): * pprint.c: (pprint_get_proc_mem), (main):

View File

@@ -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 proclist openfiles smp proclist mem wd
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
@@ -51,3 +51,10 @@ openfiles_LDADD = $(top_builddir)/lib/libgtop-2.0.la
proclist_SOURCES = proclist.c proclist_SOURCES = proclist.c
proclist_LDADD = $(top_builddir)/lib/libgtop-2.0.la proclist_LDADD = $(top_builddir)/lib/libgtop-2.0.la
wd_SOURCES = wd.c
wd_LDADD = $(top_builddir)/lib/libgtop-2.0.la
mem_SOURCE = mem.c
mem_LDADD = $(top_builddir)/lib/libgtop-2.0.la

21
examples/mem.c Normal file
View File

@@ -0,0 +1,21 @@
#include <glibtop.h>
#include <glibtop/mem.h>
#include <glib.h>
#include <unistd.h>
int main(int argc, char **argv)
{
glibtop_mem buf;
glibtop_init();
g_print("%lx\n", glibtop_global_server->features);
glibtop_get_mem(&buf);
glibtop_close();
return 0;
}

View File

@@ -13,6 +13,8 @@ int main(int argc, char **argv)
if (argc < 2 || !(pid = strtoul(argv[1], NULL, 0))) if (argc < 2 || !(pid = strtoul(argv[1], NULL, 0)))
pid = getpid(); pid = getpid();
glibtop_init();
dirs = glibtop_get_proc_wd(&buf, pid); dirs = glibtop_get_proc_wd(&buf, pid);
g_print("Process %u:\n" g_print("Process %u:\n"
@@ -26,6 +28,8 @@ int main(int argc, char **argv)
g_strfreev(dirs); g_strfreev(dirs);
glibtop_close();
return 0; return 0;
} }