Compare commits
42 Commits
libgtop_0_
...
LIBGTOP_0_
Author | SHA1 | Date | |
---|---|---|---|
|
a8b0903fe7 | ||
|
6eed554232 | ||
|
c591e6ef33 | ||
|
a72db75b78 | ||
|
8f3c38219a | ||
|
0d56ca7d04 | ||
|
70347bbfe9 | ||
|
06437c5866 | ||
|
72c987735e | ||
|
8e752ed036 | ||
|
36911a1239 | ||
|
7cadf4450c | ||
|
2a2677ea66 | ||
|
37283cfdad | ||
|
b85a419f28 | ||
|
507da6f040 | ||
|
11daaa2e1c | ||
|
0d3113e6b9 | ||
|
94d7978b44 | ||
|
86de0911cc | ||
|
8279241591 | ||
|
88c34d1415 | ||
|
a331fb8e03 | ||
|
9d564134de | ||
|
731b2879f0 | ||
|
2f140e2168 | ||
|
2bf9475dda | ||
|
6fe6cfdc15 | ||
|
a6584c2f75 | ||
|
bdefedae37 | ||
|
af50e25023 | ||
|
abfda54900 | ||
|
0ea8e591f4 | ||
|
db3d7adbaa | ||
|
f353017948 | ||
|
f66f7fde8c | ||
|
9049a19434 | ||
|
f7da79ed88 | ||
|
9d0aa0fdc1 | ||
|
fb552b8e31 | ||
|
a0b502df75 | ||
|
5a7f1d7621 |
47
ChangeLog
47
ChangeLog
@@ -1,3 +1,39 @@
|
||||
1998-09-27 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in: Do not even check for guile if it is disabled.
|
||||
|
||||
1998-09-12 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/sysinfo.h: New file. This is used in guname to
|
||||
fetch as many information about the system as possible like detailed
|
||||
information about hardware etc.
|
||||
|
||||
* configure.in (AM_PATH_GLIB): LibGTop now requires glib.
|
||||
|
||||
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
|
||||
|
||||
* include/glibtop/proctime.h (glibtop_proc_time): Added `xcpu_utime'
|
||||
and `xcpu_stime'.
|
||||
|
||||
* sysdeps/linux/ChangeLog: New file.
|
||||
|
||||
* glibtop.h (glibtop): Added `ncpu'. This is zero for single processor
|
||||
systems and the number of CPUs otherwise.
|
||||
|
||||
* include/glibtop/cpu.h (glibtop_cpu): Added `xcpu_total', `xcpu_user',
|
||||
`xcpu_nice', `xcpu_sys' and `xcpu_idle'.
|
||||
(GLIBTOP_NCPU): #define this to 4.
|
||||
|
||||
1998-09-08 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||
|
||||
* configure.in: Make the default to disable guile.
|
||||
|
||||
1998-08-30 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* LIBGTOP-VERSION (LIBGTOP_VERSION_CODE): Added. This is a numerical
|
||||
constant ("1.234.567" -> 1234567) to be used in C preprocessor
|
||||
conditionals.
|
||||
|
||||
1998-08-29 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* LIBGTOP-VERSION (LIBGTOP_INTERFACE_AGE, LIBGTOP_BINARY_AGE): Added.
|
||||
@@ -5,6 +41,17 @@
|
||||
(LT_RELEASE, LT_CURRENT, LT_REVISION, LT_AGE): AC_SUBST.
|
||||
(LT_VERSION_INFO): Sets `-version-info' for libtool.
|
||||
|
||||
* */Makefile.am: We now use the correct `-version-info' parameter
|
||||
for libtool.
|
||||
|
||||
1998-08-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/command.h (glibtop_call): Third argument is
|
||||
now `const void *'.
|
||||
|
||||
* include/glibtop/xmalloc.h (glibtop_free): Now taking a
|
||||
`const void *'.
|
||||
|
||||
1998-08-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* src/daemon/ChangeLog: New file.
|
||||
|
@@ -7,17 +7,19 @@
|
||||
# set LIBGTOP_BINARY_AGE and LIBGTOP_INTERFACE_AGE to 0.
|
||||
#
|
||||
LIBGTOP_MAJOR_VERSION=0
|
||||
LIBGTOP_MINOR_VERSION=25
|
||||
LIBGTOP_MICRO_VERSION=1
|
||||
LIBGTOP_MINOR_VERSION=26
|
||||
LIBGTOP_MICRO_VERSION=2
|
||||
|
||||
LIBGTOP_INTERFACE_AGE=0
|
||||
LIBGTOP_BINARY_AGE=0
|
||||
|
||||
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
|
||||
LIBGTOP_INTERFACE_AGE=1
|
||||
LIBGTOP_BINARY_AGE=1
|
||||
|
||||
# Increase each time you change the client/server protocol.
|
||||
LIBGTOP_SERVER_VERSION=1
|
||||
|
||||
# Don't change this
|
||||
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
|
||||
LIBGTOP_VERSION_CODE=`expr $LIBGTOP_MAJOR_VERSION*1000000+$LIBGTOP_MINOR_VERSION*1000+$LIBGTOP_MICRO_VERSION`
|
||||
|
||||
# For automake.
|
||||
VERSION=$LIBGTOP_VERSION
|
||||
PACKAGE=libgtop
|
||||
|
@@ -25,7 +25,7 @@ EXTRA_DIST = autogen.sh libgtop.spec copyright.txt libgtopConf.sh.in \
|
||||
perl/MANIFEST perl/Changes libgtop-config.in RELNOTES-0.25
|
||||
|
||||
release:
|
||||
$(MAKE) dist distdir=$(PACKAGE)$(VERSION)
|
||||
$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)
|
||||
|
||||
## Put `exec' in the name because this should be installed by
|
||||
## `install-exec', not `install-data'.
|
||||
@@ -66,6 +66,7 @@ libgtopConf.sh: libgtopConf.sh.in Makefile
|
||||
-e 's,\@LIBGTOP_MINOR_VERSION\@,$(LIBGTOP_MINOR_VERSION),g' \
|
||||
-e 's,\@LIBGTOP_MICRO_VERSION\@,$(LIBGTOP_MICRO_VERSION),g' \
|
||||
-e 's,\@LIBGTOP_VERSION\@,$(LIBGTOP_VERSION),g' \
|
||||
-e 's,\@LIBGTOP_VERSION_CODE\@,$(LIBGTOP_VERSION_CODE),g' \
|
||||
-e 's,\@LIBGTOP_SERVER_VERSION\@,$(LIBGTOP_SERVER_VERSION),g' \
|
||||
-e 's,\@libgtop_sysdeps_dir\@,$(libgtop_sysdeps_dir),g' \
|
||||
-e 's,\@libgtop_need_server\@,$(libgtop_need_server),g' \
|
||||
|
@@ -137,6 +137,7 @@
|
||||
#undef NEED_LIBGTOP
|
||||
|
||||
#undef HAVE_LINUX_TABLE
|
||||
#undef HAVE_LIBGTOP_SMP
|
||||
|
||||
#undef HAVE_XAUTH
|
||||
|
||||
|
45
configure.in
45
configure.in
@@ -16,6 +16,7 @@ AC_SUBST(LIBGTOP_INTERFACE_AGE)
|
||||
AC_SUBST(LIBGTOP_BINARY_AGE)
|
||||
AC_SUBST(LIBGTOP_SERVER_VERSION)
|
||||
AC_SUBST(LIBGTOP_VERSION)
|
||||
AC_SUBST(LIBGTOP_VERSION_CODE)
|
||||
|
||||
# libtool versioning
|
||||
LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION
|
||||
@@ -71,16 +72,18 @@ fi
|
||||
GNOME_LIBGTOP_SYSDEPS
|
||||
GNOME_LIBGTOP_TYPES
|
||||
|
||||
GNOME_CHECK_GUILE
|
||||
|
||||
dnl For Solaris
|
||||
AC_CHECK_LIB(resolv, _getnetbyaddr)
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
AC_CHECK_LIB(nsl, gethostbyname)
|
||||
|
||||
AC_ARG_WITH(libgtop-guile,
|
||||
[ --with-libgtop-guile Build the libgtop guile interface (default=yes)],
|
||||
[build_guile="$withval"], [build_guile=yes])
|
||||
[ --with-libgtop-guile Build the libgtop guile interface (default=no)],
|
||||
[build_guile="$withval"], [build_guile=no])
|
||||
|
||||
test x$build_guile = xno && ac_cv_guile_found=no
|
||||
if test x$build_guile = xyes ; then
|
||||
GNOME_CHECK_GUILE
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(libgtop-inodedb,
|
||||
[ --with-libgtop-inodedb Build the inodedb stuff (default=no)],
|
||||
@@ -112,12 +115,22 @@ else
|
||||
guile_subdirs=
|
||||
fi
|
||||
|
||||
if test x$libgtop_smp = xyes ; then
|
||||
smp_examples='smp smp_static'
|
||||
else
|
||||
smp_examples=
|
||||
fi
|
||||
|
||||
AC_SUBST(smp_examples)
|
||||
AC_SUBST(guile_examples)
|
||||
AC_SUBST(guile_subdirs)
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl You need to uncomment the following line if you want to use libgtop without Gnome.
|
||||
AM_PATH_GLIB
|
||||
|
||||
dnl You need to uncomment the following line if you want to use
|
||||
dnl libGTop without Gnome.
|
||||
dnl GNOME_SUPPORT_CHECKS
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -208,11 +221,11 @@ fi
|
||||
|
||||
dnl Some ugly hack; if '-lgnomesupport' is part of $GNOME_LIBS,
|
||||
dnl we include it here.
|
||||
echo "$GNOME_LIBS" | grep -q -e '-lgnomesupport'
|
||||
if test $? = 0 ; then
|
||||
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
||||
SUPPORTINCS="$GNOME_INCLUDEDIR"
|
||||
fi
|
||||
case "$GNOME_LIBS" in
|
||||
'*-lgnomesupport*' )
|
||||
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
||||
SUPPORTINCS="$GNOME_INCLUDEDIR" ;;
|
||||
esac
|
||||
AC_SUBST(LIBSUPPORT)
|
||||
AC_SUBST(SUPPORTINCS)
|
||||
|
||||
@@ -224,7 +237,11 @@ if test x$build_inodedb = xyes ; then
|
||||
LIBGTOP_INCS="$LIBGTOP_INCS -DGLIBTOP_INODEDB"
|
||||
fi
|
||||
|
||||
LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS"
|
||||
if test x$libgtop_have_sysinfo = xyes ; then
|
||||
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
|
||||
fi
|
||||
|
||||
LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS $GLIB_CFLAGS"
|
||||
|
||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_LIBS"
|
||||
LIBGTOP_GUILE_INCS="$LIBGTOP_INCS"
|
||||
@@ -243,7 +260,7 @@ fi
|
||||
|
||||
AC_SUBST(libgtop_guile_found)
|
||||
|
||||
if test -z $LIBGTOP_EXTRA_LIBS ; then
|
||||
if test -z "$LIBGTOP_EXTRA_LIBS" ; then
|
||||
LIBGTOP_EXTRA_LIBS="$libs_xauth"
|
||||
else
|
||||
LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $libs_xauth"
|
||||
@@ -278,7 +295,7 @@ else
|
||||
guile_def=""
|
||||
fi
|
||||
|
||||
INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_srcdir)/intl $SUPPORTINCS -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith $CFLAGS $guile_def "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
|
||||
INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_srcdir)/intl $SUPPORTINCS $GLIB_CFLAGS -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith $CFLAGS $guile_def "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
|
||||
|
||||
AC_SUBST(INCLUDES)
|
||||
|
||||
|
@@ -1,3 +1,7 @@
|
||||
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
|
||||
|
||||
* smp.c: New file. Nice tool to show CPU statistics on SMP systems.
|
||||
|
||||
1998-08-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* first.c, second.c, procmap.c: Fixed some compiler warnings.
|
||||
|
@@ -12,9 +12,9 @@ DEFS = @DEFS@
|
||||
libexec_PROGRAMS = first first_static second second_static \
|
||||
mountlist mountlist_static \
|
||||
procmap procmap_static \
|
||||
@guile_examples@
|
||||
@guile_examples@ @smp_examples@
|
||||
|
||||
EXTRA_PROGRAMS = third third_static
|
||||
EXTRA_PROGRAMS = third third_static smp smp_static
|
||||
|
||||
first_SOURCES = first.c
|
||||
first_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
@@ -74,3 +74,14 @@ mountlist_static_SOURCES= $(mountlist_SOURCES)
|
||||
mountlist_static_LDADD = $(mountlist_LDADD)
|
||||
mountlist_static_LDFLAGS= -static
|
||||
|
||||
|
||||
smp_SOURCES = smp.c
|
||||
smp_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@ @LIBGTOP_EXTRA_LIBS@
|
||||
|
||||
smp_static_SOURCES = $(smp_SOURCES)
|
||||
smp_static_LDADD = $(smp_LDADD)
|
||||
smp_static_LDFLAGS = -static
|
||||
|
||||
|
@@ -29,10 +29,20 @@
|
||||
#include <glibtop/union.h>
|
||||
#include <glibtop/sysdeps.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
static void
|
||||
output (pid_t pid)
|
||||
{
|
||||
glibtop_union data;
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
unsigned long total;
|
||||
double p_total, p_utime, p_stime;
|
||||
double b_total, b_utime, b_stime;
|
||||
double s_total, s_utime, s_stime;
|
||||
double my_utime, my_stime;
|
||||
int ncpu, i;
|
||||
#endif
|
||||
|
||||
printf ("\n");
|
||||
|
||||
@@ -124,6 +134,81 @@ output (pid_t pid)
|
||||
data.proc_kernel.wchan);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
ncpu = glibtop_global_server->ncpu;
|
||||
|
||||
glibtop_get_proc_time (&data.proc_time, pid);
|
||||
|
||||
total = (unsigned long) data.proc_time.utime +
|
||||
(unsigned long) data.proc_time.stime;
|
||||
|
||||
p_total = total ? (double) total : 1.0;
|
||||
|
||||
p_utime = (double) data.proc_time.utime * 100.0 / p_total;
|
||||
p_stime = (double) data.proc_time.stime * 100.0 / p_total;
|
||||
|
||||
b_total = p_total / ncpu;
|
||||
b_utime = (double) data.proc_time.utime / ncpu;
|
||||
b_stime = (double) data.proc_time.stime / ncpu;
|
||||
|
||||
s_total = 0.0; s_utime = 0.0; s_stime = 0.0;
|
||||
|
||||
printf ("Proc_Time PID %5d (0x%08lx): %12lu %12lu %12lu\n", (int) pid,
|
||||
(unsigned long) data.proc_time.flags, total,
|
||||
(unsigned long) data.proc_time.utime,
|
||||
(unsigned long) data.proc_time.stime);
|
||||
|
||||
for (i = 0; i < ncpu; i++) {
|
||||
unsigned long this_total;
|
||||
|
||||
this_total = (unsigned long) data.proc_time.xcpu_utime [i] +
|
||||
(unsigned long) data.proc_time.xcpu_stime [i];
|
||||
|
||||
printf ("CPU %3d PID %5d (0x%08lx): %12lu %12lu %12lu\n", i,
|
||||
(int) pid, (unsigned long) data.proc_time.flags, this_total,
|
||||
(unsigned long) data.proc_time.xcpu_utime [i],
|
||||
(unsigned long) data.proc_time.xcpu_stime [i]);
|
||||
|
||||
s_total += fabs (((double) this_total) - b_total);
|
||||
s_utime += fabs (((double) data.proc_time.xcpu_utime [i]) - b_utime);
|
||||
s_stime += fabs (((double) data.proc_time.xcpu_stime [i]) - b_stime);
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
|
||||
printf ("Proc_Time PID %5d (0x%08lx): %12.3f %12.3f %12.3f\n", (int) pid,
|
||||
(unsigned long) data.proc_time.flags, 100.0, p_utime, p_stime);
|
||||
|
||||
for (i = 0; i < ncpu; i++) {
|
||||
double this_p_total, this_p_utime, this_p_stime;
|
||||
unsigned long this_total;
|
||||
|
||||
this_total = (unsigned long) data.proc_time.xcpu_utime [i] +
|
||||
(unsigned long) data.proc_time.xcpu_stime [i];
|
||||
|
||||
this_p_total = (double) this_total * 100.0 / p_total;
|
||||
|
||||
this_p_utime = (double) data.proc_time.xcpu_utime [i] * 100.0 / p_total;
|
||||
this_p_stime = (double) data.proc_time.xcpu_stime [i] * 100.0 / p_total;
|
||||
|
||||
printf ("CPU %3d PID %5d (0x%08lx): %12.3f %12.3f %12.3f\n", i,
|
||||
(int) pid, (unsigned long) data.proc_time.flags,
|
||||
this_p_total, this_p_utime, this_p_stime);
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
|
||||
my_utime = (unsigned long) data.proc_time.utime ?
|
||||
(double) data.proc_time.utime : 1.0;
|
||||
my_stime = (unsigned long) data.proc_time.stime ?
|
||||
(double) data.proc_time.stime : 1.0;
|
||||
|
||||
printf ("SPIN: %31s %12.3f %12.3f %12.3f\n", "", s_total * 100.0 / p_total,
|
||||
s_utime * 100.0 / my_utime, s_stime * 100.0 / my_stime);
|
||||
|
||||
printf ("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
@@ -190,3 +275,6 @@ main (int argc, char *argv [])
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
124
examples/smp.c
Normal file
124
examples/smp.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, September 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
glibtop_cpu cpu;
|
||||
unsigned long frequency;
|
||||
double total, user, nice, sys, idle;
|
||||
double b_total, b_user, b_nice, b_sys, b_idle;
|
||||
double s_total, s_user, s_nice, s_sys, s_idle;
|
||||
char separator [BUFSIZ], buffer [BUFSIZ];
|
||||
int ncpu, i;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
glibtop_get_cpu (&cpu);
|
||||
|
||||
ncpu = glibtop_global_server->ncpu ? glibtop_global_server->ncpu : 1;
|
||||
|
||||
frequency = (unsigned long) cpu.frequency;
|
||||
|
||||
total = ((unsigned long) cpu.total) ? ((double) cpu.total) : 1.0;
|
||||
user = ((unsigned long) cpu.user) ? ((double) cpu.user) : 1.0;
|
||||
nice = ((unsigned long) cpu.nice) ? ((double) cpu.nice) : 1.0;
|
||||
sys = ((unsigned long) cpu.sys) ? ((double) cpu.sys) : 1.0;
|
||||
idle = ((unsigned long) cpu.idle) ? ((double) cpu.idle) : 1.0;
|
||||
|
||||
s_total = s_user = s_nice = s_sys = s_idle = 0.0;
|
||||
|
||||
b_total = total / ncpu;
|
||||
b_user = user / ncpu;
|
||||
b_nice = nice / ncpu;
|
||||
b_sys = sys / ncpu;
|
||||
b_idle = idle / ncpu;
|
||||
|
||||
memset (separator, '-', 91);
|
||||
separator [92] = '\0';
|
||||
|
||||
sprintf (buffer, _("Ticks (%d per second):"), frequency);
|
||||
|
||||
printf ("\n\n%-26s %12s %12s %12s %12s %12s\n%s\n", buffer,
|
||||
_("Total"), _("User"), _("Nice"), _("Sys"), _("Idle"), separator);
|
||||
|
||||
printf (_("CPU (0x%08lx): %12.0f %12.0f %12.0f %12.0f %12.0f\n\n"),
|
||||
(unsigned long) cpu.flags, total, user, nice, sys, idle);
|
||||
|
||||
for (i = 0; i < glibtop_global_server->ncpu; i++) {
|
||||
printf (_("CPU %3d (0x%08lx): %12lu %12lu %12lu %12lu %12lu\n"), i,
|
||||
(unsigned long) cpu.flags,
|
||||
(unsigned long) cpu.xcpu_total [i],
|
||||
(unsigned long) cpu.xcpu_user [i],
|
||||
(unsigned long) cpu.xcpu_nice [i],
|
||||
(unsigned long) cpu.xcpu_sys [i],
|
||||
(unsigned long) cpu.xcpu_idle [i]);
|
||||
|
||||
s_total += fabs (((double) cpu.xcpu_total [i]) - b_total);
|
||||
s_user += fabs (((double) cpu.xcpu_user [i]) - b_user);
|
||||
s_nice += fabs (((double) cpu.xcpu_nice [i]) - b_nice);
|
||||
s_sys += fabs (((double) cpu.xcpu_sys [i]) - b_sys);
|
||||
s_idle += fabs (((double) cpu.xcpu_idle [i]) - b_idle);
|
||||
}
|
||||
|
||||
printf ("%s\n\n\n", separator);
|
||||
|
||||
printf ("%-26s %12s %12s %12s %12s %12s\n%s\n", _("Percent:"),
|
||||
_("Total (%)"), _("User (%)"), _("Nice (%)"), _("Sys (%)"),
|
||||
_("Idle (%)"), separator);
|
||||
|
||||
printf (_("CPU (0x%08lx): %12.3f %12.3f %12.3f %12.3f %12.3f\n\n"),
|
||||
(unsigned long) cpu.flags, (double) total * 100.0 / total,
|
||||
(double) user * 100.0 / total,
|
||||
(double) nice * 100.0 / total,
|
||||
(double) sys * 100.0 / total,
|
||||
(double) idle * 100.0 / total);
|
||||
|
||||
for (i = 0; i < glibtop_global_server->ncpu; i++) {
|
||||
double p_total, p_user, p_nice, p_sys, p_idle;
|
||||
|
||||
p_total = ((double) cpu.xcpu_total [i]) * 100.0 / total;
|
||||
p_user = ((double) cpu.xcpu_user [i]) * 100.0 / user;
|
||||
p_nice = ((double) cpu.xcpu_nice [i]) * 100.0 / nice;
|
||||
p_sys = ((double) cpu.xcpu_sys [i]) * 100.0 / sys;
|
||||
p_idle = ((double) cpu.xcpu_idle [i]) * 100.0 / idle;
|
||||
|
||||
printf (_("CPU %3d (0x%08lx): %12.3f %12.3f %12.3f %12.3f %12.3f\n"),
|
||||
i, (unsigned long) cpu.flags, p_total, p_user, p_nice,
|
||||
p_sys, p_idle);
|
||||
}
|
||||
|
||||
printf ("%s\n%-26s %12.3f %12.3f %12.3f %12.3f %12.3f\n\n", separator,
|
||||
_("Spin:"), s_total * 100.0 / total, s_user * 100.0 / user,
|
||||
s_nice * 100.0 / nice, s_sys * 100.0 / sys, s_idle * 100.0 / idle);
|
||||
|
||||
exit (0);
|
||||
}
|
@@ -50,6 +50,7 @@ struct _glibtop
|
||||
int input [2]; /* Pipe client <- server */
|
||||
int output [2]; /* Pipe client -> server */
|
||||
int socket; /* Accepted connection of a socket */
|
||||
int ncpu; /* Number of CPUs, zero if single-processor */
|
||||
unsigned long os_version_code; /* Version code of the operating system */
|
||||
const char *name; /* Program name for error messages */
|
||||
const char *server_command; /* Command used to invoke server */
|
||||
|
@@ -32,7 +32,7 @@ function output(line) {
|
||||
list = params[param];
|
||||
type = params[param];
|
||||
sub(/\(.*/, "", type);
|
||||
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
|
||||
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
|
||||
|
||||
string = string" (\""type"\"";
|
||||
|
||||
|
@@ -7,4 +7,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
|
||||
procsegment.h read.h sysdeps.h xmalloc.h global.h \
|
||||
procsignal.h read_data.h union.h types.h gnuserv.h \
|
||||
parameter.h mountlist.h fsusage.h procmap.h signal.h \
|
||||
inodedb.h
|
||||
inodedb.h sysinfo.h
|
||||
|
@@ -84,8 +84,8 @@ struct _glibtop_response
|
||||
|
||||
#define glibtop_call(p1, p2, p3, p4) glibtop_call_r(glibtop_global_server, p1, p2, p3, p4)
|
||||
|
||||
extern void *glibtop_call_l __P((glibtop *, unsigned, size_t, void *, size_t, void *));
|
||||
extern void *glibtop_call_s __P((glibtop *, unsigned, size_t, void *, size_t, void *));
|
||||
extern void *glibtop_call_l __P((glibtop *, unsigned, size_t, const void *, size_t, void *));
|
||||
extern void *glibtop_call_s __P((glibtop *, unsigned, size_t, const void *, size_t, void *));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@@ -34,19 +34,33 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_CPU_IDLE 4
|
||||
#define GLIBTOP_CPU_FREQUENCY 5
|
||||
|
||||
#define GLIBTOP_MAX_CPU 6
|
||||
#define GLIBTOP_XCPU_TOTAL 6
|
||||
#define GLIBTOP_XCPU_USER 7
|
||||
#define GLIBTOP_XCPU_NICE 8
|
||||
#define GLIBTOP_XCPU_SYS 9
|
||||
#define GLIBTOP_XCPU_IDLE 10
|
||||
|
||||
#define GLIBTOP_MAX_CPU 11
|
||||
|
||||
/* Nobody should really be using more than 4 processors. */
|
||||
#define GLIBTOP_NCPU 4
|
||||
|
||||
typedef struct _glibtop_cpu glibtop_cpu;
|
||||
|
||||
struct _glibtop_cpu
|
||||
{
|
||||
u_int64_t flags,
|
||||
total, /* GLIBTOP_CPU_TOTAL */
|
||||
user, /* GLIBTOP_CPU_USER */
|
||||
nice, /* GLIBTOP_CPU_NICE */
|
||||
sys, /* GLIBTOP_CPU_SYS */
|
||||
idle, /* GLIBTOP_CPU_IDLE */
|
||||
frequency; /* GLIBTOP_CPU_FREQUENCY */
|
||||
total, /* GLIBTOP_CPU_TOTAL */
|
||||
user, /* GLIBTOP_CPU_USER */
|
||||
nice, /* GLIBTOP_CPU_NICE */
|
||||
sys, /* GLIBTOP_CPU_SYS */
|
||||
idle, /* GLIBTOP_CPU_IDLE */
|
||||
frequency, /* GLIBTOP_CPU_FREQUENCY */
|
||||
xcpu_total [GLIBTOP_NCPU], /* GLIBTOP_XCPU_TOTAL */
|
||||
xcpu_user [GLIBTOP_NCPU], /* GLIBTOP_XCPU_USER */
|
||||
xcpu_nice [GLIBTOP_NCPU], /* GLIBTOP_XCPU_NICE */
|
||||
xcpu_sys [GLIBTOP_NCPU], /* GLIBTOP_XCPU_SYS */
|
||||
xcpu_idle [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IDLE */
|
||||
};
|
||||
|
||||
#define glibtop_get_cpu(cpu) glibtop_get_cpu_l(glibtop_global_server, cpu)
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#define __GLIBTOP_PROCTIME_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/global.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
@@ -36,8 +37,10 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_PROC_TIME_TIMEOUT 6
|
||||
#define GLIBTOP_PROC_TIME_IT_REAL_VALUE 7
|
||||
#define GLIBTOP_PROC_TIME_FREQUENCY 8
|
||||
#define GLIBTOP_PROC_TIME_XCPU_UTIME 9
|
||||
#define GLIBTOP_PROC_TIME_XCPU_STIME 10
|
||||
|
||||
#define GLIBTOP_MAX_PROC_TIME 9
|
||||
#define GLIBTOP_MAX_PROC_TIME 11
|
||||
|
||||
typedef struct _glibtop_proc_time glibtop_proc_time;
|
||||
|
||||
@@ -60,7 +63,9 @@ struct _glibtop_proc_time
|
||||
it_real_value, /* The time (in jiffies) before the
|
||||
* next SIGALRM is sent to the process
|
||||
* due to an interval timer. */
|
||||
frequency; /* Tick frequency. */
|
||||
frequency, /* Tick frequency. */
|
||||
xcpu_utime [GLIBTOP_NCPU], /* utime and stime for all CPUs on */
|
||||
xcpu_stime [GLIBTOP_NCPU]; /* SMP machines. */
|
||||
};
|
||||
|
||||
#define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time_l(glibtop_global_server, p1, p2)
|
||||
|
62
include/glibtop/sysinfo.h
Normal file
62
include/glibtop/sysinfo.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __GLIBTOP_SYSINFO_H__
|
||||
#define __GLIBTOP_SYSINFO_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/global.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_SYSINFO_CPUINFO 0
|
||||
|
||||
#define GLIBTOP_MAX_SYSINFO 1
|
||||
|
||||
typedef struct _glibtop_sysinfo glibtop_sysinfo;
|
||||
|
||||
typedef struct _glibtop_entry glibtop_entry;
|
||||
|
||||
struct _glibtop_entry
|
||||
{
|
||||
GPtrArray *labels;
|
||||
GHashTable *values;
|
||||
GHashTable *descriptions;
|
||||
};
|
||||
|
||||
struct _glibtop_sysinfo
|
||||
{
|
||||
u_int64_t flags, ncpu;
|
||||
glibtop_entry cpuinfo [GLIBTOP_NCPU];
|
||||
};
|
||||
|
||||
#define glibtop_get_sysinfo() glibtop_get_sysinfo_s(glibtop_global_server)
|
||||
|
||||
#define glibtop_get_sysinfo_r glibtop_get_sysinfo_s
|
||||
|
||||
extern glibtop_sysinfo * glibtop_get_sysinfo_s __P((glibtop *));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
@@ -37,7 +37,7 @@ extern void *glibtop_malloc_r __P((glibtop *, size_t));
|
||||
extern void *glibtop_calloc_r __P((glibtop *, size_t, size_t));
|
||||
extern void *glibtop_realloc_r __P((glibtop *, void *, size_t));
|
||||
extern char *glibtop_strdup_r __P((glibtop *, const char *));
|
||||
extern void glibtop_free_r __P((glibtop *, void *));
|
||||
extern void glibtop_free_r __P((glibtop *, const void *));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@@ -8,6 +8,8 @@ libgtop_la_SOURCES = init.c open.c close.c command.c read.c \
|
||||
read_data.c write.c lib.c parameter.c \
|
||||
sysdeps.c
|
||||
|
||||
libgtop_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
BUILT_SOURCES = lib.c
|
||||
|
||||
lib.c: lib.awk $(top_builddir)/config.h $(top_srcdir)/features.def
|
||||
|
@@ -28,7 +28,7 @@
|
||||
|
||||
void *
|
||||
glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
|
||||
void *send_buf, size_t recv_size, void *recv_buf)
|
||||
const void *send_buf, size_t recv_size, void *recv_buf)
|
||||
{
|
||||
glibtop_command cmnd;
|
||||
glibtop_response response;
|
||||
|
10
lib/lib.awk
10
lib/lib.awk
@@ -68,7 +68,7 @@ function output(line) {
|
||||
if (param_def == "string") {
|
||||
call_param = ", "line_fields[5];
|
||||
param_decl = ",\n "space" const char *"line_fields[5];
|
||||
send_ptr = "\n\tvoid *send_ptr = "line_fields[5]";";
|
||||
send_ptr = "\n\tconst void *send_ptr = "line_fields[5]";";
|
||||
send_size = "\n\tconst size_t send_size =\n\t\tstrlen ("line_fields[5]") + 1;";
|
||||
} else {
|
||||
call_param = "";
|
||||
@@ -80,7 +80,7 @@ function output(line) {
|
||||
list = params[param];
|
||||
type = params[param];
|
||||
sub(/\(.*/, "", type);
|
||||
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
|
||||
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
|
||||
count = split (list, fields, /,/);
|
||||
for (field = 1; field <= count; field++) {
|
||||
if (param_decl == "")
|
||||
@@ -90,7 +90,7 @@ function output(line) {
|
||||
param_decl = param_decl""convert[type]" "fields[field];
|
||||
call_param = call_param", "fields[field];
|
||||
if (send_ptr == "")
|
||||
send_ptr = "\n\tvoid *send_ptr = &"fields[field]";";
|
||||
send_ptr = "\n\tconst void *send_ptr = &"fields[field]";";
|
||||
if (send_size == "")
|
||||
send_size = "\n\tconst size_t send_size =\n\t\t";
|
||||
else
|
||||
@@ -103,14 +103,14 @@ function output(line) {
|
||||
else
|
||||
send_size = "\n\tconst size_t send_size = 0;";
|
||||
if (send_ptr == "")
|
||||
send_ptr = "\n\tvoid *send_ptr = NULL;";
|
||||
send_ptr = "\n\tconst void *send_ptr = NULL;";
|
||||
}
|
||||
|
||||
print "glibtop_get_"feature"_l (glibtop *server, glibtop_"feature" *buf"param_decl")";
|
||||
|
||||
print "{"send_ptr""send_size;
|
||||
if (retval !~ /^void$/)
|
||||
print "\t"retval" retval;";
|
||||
print "\t"retval" retval = ("retval") 0;";
|
||||
print "";
|
||||
|
||||
print "\tglibtop_init_r (&server, (1 << GLIBTOP_SYSDEPS_"toupper(feature)"), 0);";
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# Note that this is NOT a relocatable package
|
||||
%define ver 0.25.1
|
||||
%define ver 0.26.2
|
||||
%define rel SNAP
|
||||
%define prefix /usr
|
||||
|
||||
|
@@ -25,7 +25,9 @@ LIBGTOP_SERVER="@LIBGTOP_SERVER@"
|
||||
LIBGTOP_MAJOR_VERSION="@LIBGTOP_MAJOR_VERSION@"
|
||||
LIBGTOP_MINOR_VERSION="@LIBGTOP_MINOR_VERSION@"
|
||||
LIBGTOP_MICRO_VERSION="@LIBGTOP_MICRO_VERSION@"
|
||||
|
||||
LIBGTOP_VERSION="@LIBGTOP_VERSION@"
|
||||
LIBGTOP_VERSION_CODE="@LIBGTOP_VERSION_CODE@"
|
||||
|
||||
LIBGTOP_SERVER_VERSION="@LIBGTOP_SERVER_VERSION@"
|
||||
|
||||
|
326
po/fr.po
326
po/fr.po
@@ -13,50 +13,6 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=iso-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: lib/read.c:69
|
||||
msgid "read %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: lib/read_data.c:47
|
||||
msgid "read data size"
|
||||
msgstr ""
|
||||
|
||||
#: lib/read_data.c:64
|
||||
msgid "read data %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: lib/write.c:46
|
||||
msgid "write %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:37
|
||||
msgid "Load Average"
|
||||
msgstr "Charge Moyenne"
|
||||
|
||||
#: sysdeps/names/loadavg.c:38
|
||||
msgid "Running Tasks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:39
|
||||
msgid "Number of Tasks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:40 sysdeps/names/loadavg.c:48
|
||||
msgid "Last PID"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:45
|
||||
msgid "Number of jobs running simultaneously averaged over 1, 5 and 15 minutes"
|
||||
msgstr "Nombre de processus tournant simultannement en moyenne sur 1, 5 et 15 minutes"
|
||||
|
||||
#: sysdeps/names/loadavg.c:46
|
||||
msgid "Number of tasks currently running"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:47
|
||||
msgid "Total number of tasks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/cpu.c:37
|
||||
msgid "Total CPU Time"
|
||||
msgstr "Temps CPU Total"
|
||||
@@ -105,33 +61,61 @@ msgstr ""
|
||||
msgid "All of the above values are in jiffies (1/100ths of a second) unless otherwise stated in this field (i.e. 'frequency != 100')"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/msg_limits.c:38 sysdeps/names/msg_limits.c:49
|
||||
msgid "Size in kilobytes of message pool"
|
||||
msgstr "Taille en kilo-octets du pool de messages"
|
||||
|
||||
#: sysdeps/names/msg_limits.c:39 sysdeps/names/msg_limits.c:50
|
||||
msgid "Number of entries in message map"
|
||||
#: sysdeps/names/fsusage.c:37 sysdeps/names/fsusage.c:46
|
||||
msgid "Total blocks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/msg_limits.c:40 sysdeps/names/msg_limits.c:51
|
||||
msgid "Max size of message"
|
||||
msgstr "Taille maximum des messages"
|
||||
#: sysdeps/names/fsusage.c:38
|
||||
msgid "Free blocks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/msg_limits.c:41 sysdeps/names/msg_limits.c:52
|
||||
msgid "Default max size of queue"
|
||||
msgstr "Taille maximum par d\351faut de la queue"
|
||||
#: sysdeps/names/fsusage.c:39
|
||||
msgid "Available blocks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/msg_limits.c:42 sysdeps/names/msg_limits.c:53
|
||||
msgid "Max queues system wide"
|
||||
msgstr "Nombre maximum de queues dans le syst\350me"
|
||||
#: sysdeps/names/fsusage.c:40 sysdeps/names/fsusage.c:49
|
||||
msgid "Total file nodes"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/msg_limits.c:43 sysdeps/names/msg_limits.c:54
|
||||
msgid "Message segment size"
|
||||
msgstr "Taille des segments de messages"
|
||||
#: sysdeps/names/fsusage.c:41 sysdeps/names/fsusage.c:50
|
||||
msgid "Free file nodes"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/msg_limits.c:44 sysdeps/names/msg_limits.c:55
|
||||
msgid "Number of system message headers"
|
||||
msgstr "Nombre d'entetes de messages syst\350me"
|
||||
#: sysdeps/names/fsusage.c:47
|
||||
msgid "Free blocks available to the superuser"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/fsusage.c:48
|
||||
msgid "Free blocks available to non-superusers"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:37
|
||||
msgid "Load Average"
|
||||
msgstr "Charge Moyenne"
|
||||
|
||||
#: sysdeps/names/loadavg.c:38
|
||||
msgid "Running Tasks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:39
|
||||
msgid "Number of Tasks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:40 sysdeps/names/loadavg.c:48
|
||||
msgid "Last PID"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:45
|
||||
msgid "Number of jobs running simultaneously averaged over 1, 5 and 15 minutes"
|
||||
msgstr "Nombre de processus tournant simultannement en moyenne sur 1, 5 et 15 minutes"
|
||||
|
||||
#: sysdeps/names/loadavg.c:46
|
||||
msgid "Number of tasks currently running"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/loadavg.c:47
|
||||
msgid "Total number of tasks"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/mem.c:39
|
||||
msgid "Total Memory"
|
||||
@@ -197,6 +181,46 @@ msgstr "M\351moire utilis\351e par les processus utilisateurs en Ko"
|
||||
msgid "Memory in locked pages in kB"
|
||||
msgstr "M\351moire dans les pages v\351rouill\351es en Ko"
|
||||
|
||||
#: sysdeps/names/mountlist.c:36 sysdeps/names/mountlist.c:43 sysdeps/names/proclist.c:36 sysdeps/names/proclist.c:43 sysdeps/names/procmap.c:36 sysdeps/names/procmap.c:43
|
||||
msgid "Number of list elements"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/mountlist.c:37 sysdeps/names/mountlist.c:44 sysdeps/names/proclist.c:37 sysdeps/names/proclist.c:44 sysdeps/names/procmap.c:37 sysdeps/names/procmap.c:44
|
||||
msgid "Total size of list"
|
||||
msgstr "Taille totalle de la liste"
|
||||
|
||||
#: sysdeps/names/mountlist.c:38 sysdeps/names/mountlist.c:45 sysdeps/names/proclist.c:38 sysdeps/names/proclist.c:45 sysdeps/names/procmap.c:38 sysdeps/names/procmap.c:45
|
||||
msgid "Size of a single list element"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/msg_limits.c:38 sysdeps/names/msg_limits.c:49
|
||||
msgid "Size in kilobytes of message pool"
|
||||
msgstr "Taille en kilo-octets du pool de messages"
|
||||
|
||||
#: sysdeps/names/msg_limits.c:39 sysdeps/names/msg_limits.c:50
|
||||
msgid "Number of entries in message map"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/msg_limits.c:40 sysdeps/names/msg_limits.c:51
|
||||
msgid "Max size of message"
|
||||
msgstr "Taille maximum des messages"
|
||||
|
||||
#: sysdeps/names/msg_limits.c:41 sysdeps/names/msg_limits.c:52
|
||||
msgid "Default max size of queue"
|
||||
msgstr "Taille maximum par d\351faut de la queue"
|
||||
|
||||
#: sysdeps/names/msg_limits.c:42 sysdeps/names/msg_limits.c:53
|
||||
msgid "Max queues system wide"
|
||||
msgstr "Nombre maximum de queues dans le syst\350me"
|
||||
|
||||
#: sysdeps/names/msg_limits.c:43 sysdeps/names/msg_limits.c:54
|
||||
msgid "Message segment size"
|
||||
msgstr "Taille des segments de messages"
|
||||
|
||||
#: sysdeps/names/msg_limits.c:44 sysdeps/names/msg_limits.c:55
|
||||
msgid "Number of system message headers"
|
||||
msgstr "Nombre d'entetes de messages syst\350me"
|
||||
|
||||
#: sysdeps/names/prockernel.c:40
|
||||
msgid "K_Flags"
|
||||
msgstr ""
|
||||
@@ -282,18 +306,6 @@ msgstr ""
|
||||
msgid "This is the textual name of the `nwchan' field."
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/proclist.c:36 sysdeps/names/proclist.c:43
|
||||
msgid "Number of list elements"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/proclist.c:37 sysdeps/names/proclist.c:44
|
||||
msgid "Total size of list"
|
||||
msgstr "Taille totalle de la liste"
|
||||
|
||||
#: sysdeps/names/proclist.c:38 sysdeps/names/proclist.c:45
|
||||
msgid "Size of a single list element"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/procmem.c:45
|
||||
msgid "Size"
|
||||
msgstr ""
|
||||
@@ -726,22 +738,6 @@ msgstr ""
|
||||
msgid "Total number of swap pages that have been brought out since system boot"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/names/uptime.c:36
|
||||
msgid "Uptime"
|
||||
msgstr "Uptime"
|
||||
|
||||
#: sysdeps/names/uptime.c:37
|
||||
msgid "Idletime"
|
||||
msgstr "Idletime"
|
||||
|
||||
#: sysdeps/names/uptime.c:42
|
||||
msgid "Time in seconds since system boot"
|
||||
msgstr "Temps en secondes depuis le d\351marrage du syst\350me"
|
||||
|
||||
#: sysdeps/names/uptime.c:43
|
||||
msgid "Time in seconds the system spent in the idle task since system boot"
|
||||
msgstr "Temps en secondes pass\351 dans le processus inactif depuis le d\351marrage du syst\350me"
|
||||
|
||||
#: sysdeps/names/sysdeps.c:46 sysdeps/names/sysdeps.c:70
|
||||
msgid "Server Features"
|
||||
msgstr ""
|
||||
@@ -826,128 +822,36 @@ msgstr ""
|
||||
msgid "List of currently mounted filesystems"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:26
|
||||
msgid "Hangup"
|
||||
#: sysdeps/names/uptime.c:36
|
||||
msgid "Uptime"
|
||||
msgstr "Uptime"
|
||||
|
||||
#: sysdeps/names/uptime.c:37
|
||||
msgid "Idletime"
|
||||
msgstr "Idletime"
|
||||
|
||||
#: sysdeps/names/uptime.c:42
|
||||
msgid "Time in seconds since system boot"
|
||||
msgstr "Temps en secondes depuis le d\351marrage du syst\350me"
|
||||
|
||||
#: sysdeps/names/uptime.c:43
|
||||
msgid "Time in seconds the system spent in the idle task since system boot"
|
||||
msgstr "Temps en secondes pass\351 dans le processus inactif depuis le d\351marrage du syst\350me"
|
||||
|
||||
#: lib/read.c:69
|
||||
msgid "read %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:27
|
||||
msgid "Interrupt"
|
||||
#: lib/read_data.c:47
|
||||
msgid "read data size"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:28
|
||||
msgid "Quit"
|
||||
#: lib/read_data.c:64
|
||||
msgid "read data %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:29
|
||||
msgid "Illegal instruction"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:30
|
||||
msgid "Trace trap"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:31
|
||||
msgid "Abort"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:32
|
||||
msgid "EMT error"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:33
|
||||
msgid "Floating-point exception"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:34
|
||||
msgid "Kill"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:35
|
||||
msgid "Bus error"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:36
|
||||
msgid "Segmentation violation"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:37
|
||||
msgid "Bad argument to system call"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:38
|
||||
msgid "Broken pipe"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:39
|
||||
msgid "Alarm clock"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:40
|
||||
msgid "Termination"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:41
|
||||
msgid "Urgent condition on socket"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:42
|
||||
msgid "Stop"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:43
|
||||
msgid "Keyboard stop"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:44
|
||||
msgid "Continue"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:45
|
||||
msgid "Child status has changed"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:46
|
||||
msgid "Background read from tty"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:47
|
||||
msgid "Background write to tty"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:48
|
||||
msgid "I/O now possible"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:49
|
||||
msgid "CPU limit exceeded"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:50
|
||||
msgid "File size limit exceeded"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:51
|
||||
msgid "Virtual alarm clock"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:52
|
||||
msgid "Profiling alarm clock"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:53
|
||||
msgid "Window size change"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:54
|
||||
msgid "Information request"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:55
|
||||
msgid "User defined signal 1"
|
||||
msgstr ""
|
||||
|
||||
#: sysdeps/osf1/siglist.c:56
|
||||
msgid "User defined signal 2"
|
||||
#: lib/write.c:46
|
||||
msgid "write %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: support/argp-help.c:185
|
||||
@@ -1018,6 +922,10 @@ msgstr ""
|
||||
msgid "(PROGRAM ERROR) Option should have been recognized!?"
|
||||
msgstr ""
|
||||
|
||||
#: support/error.c:109
|
||||
msgid "Unknown system error"
|
||||
msgstr ""
|
||||
|
||||
#: support/getopt.c:669
|
||||
msgid "%s: option `%s' is ambiguous\n"
|
||||
msgstr ""
|
||||
|
@@ -23,12 +23,10 @@ libgtop_daemon_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
@sysdeps_suid_lib@ \
|
||||
$(suid_sysdeps) $(suid_common)\
|
||||
@INTLLIBS@ @LIBSUPPORT@ @X_LIBS@ -lXau
|
||||
libgtop_daemon_LDFLAGS = -static
|
||||
|
||||
libgtop_server_SOURCES = server.c slave.c io.c version.c daemon.h
|
||||
libgtop_server_LDADD = $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps_suid.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_suid_common.la \
|
||||
@LIBSUPPORT@
|
||||
libgtop_server_LDFLAGS = -static
|
||||
|
||||
EXTRA_DIST = server_config.h.in server_config.pl
|
||||
|
@@ -1,73 +0,0 @@
|
||||
Not all UNIXes provide an easy way to get the filename if you have
|
||||
the device it is mounted on and its inode.
|
||||
|
||||
Well, under Linux we can simply read /proc/<pid>/maps to get the filenames
|
||||
but I don't see any way to get this under FreeBSD.
|
||||
|
||||
In this case you can give configure the optional `--with-libgtop-inodedb'
|
||||
parameter to build this stuff here.
|
||||
|
||||
It uses the GNU database library `gdbm' to find the inode in a database
|
||||
which is created when libgtop is installed. This should be reasonable
|
||||
fast since the entire filesystem only needs to be traversed once when
|
||||
libgtop is installed (and each time you install new software, of cause).
|
||||
|
||||
We have two databases:
|
||||
|
||||
* First the system administrator may place a system-wide database
|
||||
in `$(prefix)/var/libgtop/inodedb.db' when installing libgtop.
|
||||
|
||||
* Every user can have his/her own one in `~/var/libgtop/inodedb.db'.
|
||||
This one has precedence over the system wide one.
|
||||
|
||||
The `mkinodedb' program which is build in this directory takes two
|
||||
command line arguments: the full pathname of the database to be created
|
||||
and the name of a configuration file consisting of directory and file names
|
||||
each on a line by itself - see `/etc/ld.so.conf' for an example.
|
||||
|
||||
Putting a directory name in this file means all regular files found in this
|
||||
directory are included in the database, but it will not recursively descend
|
||||
into subdirectories (for instance, we want everythink in `/usr/lib' but not
|
||||
every single file in `/usr/lib/sgml'). You can also use filenames to include
|
||||
a single file.
|
||||
|
||||
To use this interface in your program, you first have to call
|
||||
`glibtop_inodedb_open ()':
|
||||
|
||||
glibtop_inodedb *
|
||||
glibtop_inodedb_open (unsigned databases, unsigned long cachesize)
|
||||
|
||||
glibtop_inodedb *
|
||||
glibtop_inodedb_open_s (glibtop *server, unsigned databases,
|
||||
unsigned long cachesize)
|
||||
|
||||
There are some constants defined in <glibtop/inodedb.h> for the `databases'
|
||||
parameter - you can use zero as default:
|
||||
|
||||
#define GLIBTOP_INODEDB_SYSTEM 1
|
||||
#define GLIBTOP_INODEDB_USER 2
|
||||
#define GLIBTOP_INODEDB_CACHE 4
|
||||
|
||||
The `cachesize' gives the size of a not yet implemented in-memory cache for
|
||||
looked up entries.
|
||||
|
||||
This function will return a pointer of type `glibtop_inodedb *' which you need
|
||||
to lookup an entry in the database.
|
||||
|
||||
To look up an entry, use the `glibtop_inodedb_lookup ()' function:
|
||||
|
||||
const char *
|
||||
glibtop_inodedb_lookup (glibtop_inodedb *inodedb,
|
||||
u_int64_t device, u_int64_t inode)
|
||||
const char *
|
||||
glibtop_inodedb_lookup_s (glibtop *server, glibtop_inodedb *inodedb,
|
||||
u_int64_t device, u_int64_t inode)
|
||||
|
||||
It will either return a pointer to the filename - which you have to
|
||||
`glibtop_free ()' once done with it - or NULL on error.
|
||||
|
||||
You can use the `file_by_inode' program in this directory to test the
|
||||
interface - just call it with two command line arguments: the device number
|
||||
and the inode number.
|
||||
|
||||
Martin <martin@home-of-linux.org>
|
@@ -16,6 +16,11 @@ libgtop_common_la_SOURCES = xmalloc.c error.c gnuslib.c \
|
||||
fsusage.c fsusage.h mountlist.c mountlist.h \
|
||||
$(inodedb_SRCLIST)
|
||||
|
||||
libgtop_common_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_common_la_LIBADD = $(LIBGTOP_EXTRA_LIBS)
|
||||
|
||||
libgtop_suid_common_la_SOURCES = xmalloc.c error.c sysdeps_suid.c
|
||||
|
||||
libgtop_suid_common_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
EXTRA_DIST = inodedb.c
|
||||
|
@@ -64,7 +64,7 @@ glibtop_strdup_r (glibtop *server, const char *string)
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_free_r (glibtop *server, void *ptr)
|
||||
glibtop_free_r (glibtop *server, const void *ptr)
|
||||
{
|
||||
if (ptr) free (ptr);
|
||||
if (ptr) free ((void *) ptr);
|
||||
}
|
||||
|
@@ -8,12 +8,16 @@ lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
|
||||
|
||||
libgtop_sysdeps_la_SOURCES = nosuid.c siglist.c
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procmap.c
|
||||
|
||||
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
include_HEADERS = glibtop_server.h glibtop_machine.h \
|
||||
glibtop_suid.h
|
||||
|
||||
|
@@ -8,6 +8,8 @@ lib_LTLIBRARIES = libgtop_guile.la
|
||||
|
||||
libgtop_guile_la_SOURCES = guile.c
|
||||
|
||||
libgtop_guile_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
BUILT_SOURCES = guile.c
|
||||
|
||||
guile.c: guile.awk $(top_builddir)/config.h $(top_srcdir)/features.def
|
||||
|
@@ -48,7 +48,7 @@ function make_output(line) {
|
||||
list = params[param];
|
||||
type = params[param];
|
||||
sub(/\(.*/, "", type);
|
||||
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
|
||||
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
|
||||
count = split (list, fields, /,/);
|
||||
total_nr_params = total_nr_params + count;
|
||||
for (field = 1; field <= count; field++) {
|
||||
@@ -87,7 +87,7 @@ function make_output(line) {
|
||||
list = elements[element];
|
||||
type = elements[element];
|
||||
sub(/\(.*/, "", type);
|
||||
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
|
||||
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
|
||||
count = split (list, fields, /,/);
|
||||
for (field = 1; field <= count; field++) {
|
||||
output = output""convert[type]" ("feature"."fields[field]"),\n\t\t\t";
|
||||
|
@@ -6,6 +6,8 @@ lib_LTLIBRARIES = libgtop_guile_names.la
|
||||
|
||||
libgtop_guile_names_la_SOURCES = guile-names.c
|
||||
|
||||
libgtop_guile_names_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
BUILT_SOURCES = guile-names.c
|
||||
|
||||
guile-names.c: guile-names.awk $(top_builddir)/config.h $(top_srcdir)/features.def
|
||||
|
@@ -10,6 +10,8 @@ libgtop_sysdeps_la_SOURCES = open.c close.c kernel.s cpu.c mem.c swap.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c siglist.c procmap.c
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
include_HEADERS = glibtop_server.h
|
||||
|
||||
kernel.o kernel.lo: $(srcdir)/kernel.s
|
||||
|
14
sysdeps/linux/ChangeLog
Normal file
14
sysdeps/linux/ChangeLog
Normal file
@@ -0,0 +1,14 @@
|
||||
1998-09-12 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* sysinfo.c: New file.
|
||||
|
||||
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
|
||||
|
||||
* proctime.c (glibtop_get_proc_time_s): Added SMP support.
|
||||
|
||||
* open.c (glibtop_init_s): Initialize `ncpu' on SMP systems.
|
||||
|
||||
* cpu.c (glibtop_get_cpu_s): Added SMP support.
|
||||
|
||||
* ChangeLog: New file.
|
||||
|
@@ -8,6 +8,9 @@ libgtop_sysdeps_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procmap.c siglist.c
|
||||
procsegment.c procmap.c siglist.c sysinfo.c
|
||||
libgtop_sysdeps_la_LIBADD = @GLIB_LIBS@
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
include_HEADERS = glibtop_server.h glibtop_machine.h
|
||||
|
@@ -28,12 +28,21 @@ static const unsigned long _glibtop_sysdeps_cpu =
|
||||
(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) +
|
||||
(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu_smp =
|
||||
(1 << GLIBTOP_XCPU_TOTAL) + (1 << GLIBTOP_XCPU_USER) +
|
||||
(1 << GLIBTOP_XCPU_NICE) + (1 << GLIBTOP_XCPU_SYS) +
|
||||
(1 << GLIBTOP_XCPU_IDLE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_cpu_s (glibtop *server)
|
||||
{
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu | _glibtop_sysdeps_cpu_smp;
|
||||
#else
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
@@ -44,14 +53,12 @@ void
|
||||
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
char buffer [BUFSIZ], *p;
|
||||
int fd, len;
|
||||
int fd, len, i;
|
||||
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd < 0)
|
||||
glibtop_error_io_r (server, "open (%s)", FILENAME);
|
||||
@@ -74,4 +81,23 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
|
||||
|
||||
buf->frequency = 100;
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
for (i = 0; i < GLIBTOP_NCPU; i++) {
|
||||
if (strncmp (p+1, "cpu", 3) || !isdigit (p [4]))
|
||||
break;
|
||||
|
||||
p += 6;
|
||||
buf->xcpu_user [i] = strtoul (p, &p, 0);
|
||||
buf->xcpu_nice [i] = strtoul (p, &p, 0);
|
||||
buf->xcpu_sys [i] = strtoul (p, &p, 0);
|
||||
buf->xcpu_idle [i] = strtoul (p, &p, 0);
|
||||
|
||||
buf->xcpu_total [i] = buf->xcpu_user [i] + buf->xcpu_nice [i] +
|
||||
buf->xcpu_sys [i] + buf->xcpu_idle [i];
|
||||
}
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_cpu_smp;
|
||||
#endif
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/open.h>
|
||||
|
||||
/* =====================================================
|
||||
@@ -50,12 +52,52 @@ static void set_linux_version(void) {
|
||||
|
||||
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
||||
|
||||
#define FILENAME "/proc/stat"
|
||||
|
||||
void
|
||||
glibtop_open_s (glibtop *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{
|
||||
#ifdef HAVE_LIBGTOP_SMP
|
||||
char buffer [BUFSIZ], *p;
|
||||
int fd, len, i;
|
||||
#endif
|
||||
|
||||
server->name = program_name;
|
||||
|
||||
set_linux_version ();
|
||||
server->os_version_code = (unsigned long) linux_version_code;
|
||||
|
||||
server->ncpu = 0;
|
||||
|
||||
#ifdef HAVE_LIBGTOP_SMP
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd < 0)
|
||||
glibtop_error_io_r (server, "open (%s)", FILENAME);
|
||||
|
||||
len = read (fd, buffer, BUFSIZ-1);
|
||||
if (len < 0)
|
||||
glibtop_error_io_r (server, "read (%s)", FILENAME);
|
||||
|
||||
close (fd);
|
||||
|
||||
buffer [len] = '\0';
|
||||
|
||||
p = skip_multiple_token (buffer, 5) + 1;
|
||||
|
||||
for (i = 0; i < GLIBTOP_NCPU; i++) {
|
||||
|
||||
if (strncmp (p, "cpu", 3) || !isdigit (p [3]))
|
||||
break;
|
||||
|
||||
server->ncpu++;
|
||||
|
||||
p = skip_multiple_token (p, 5) + 1;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
printf ("\nThis machine has %d CPUs.\n\n", server->ncpu);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@@ -30,12 +30,20 @@ static const unsigned long _glibtop_sysdeps_proc_time =
|
||||
(1 << GLIBTOP_PROC_TIME_TIMEOUT) + (1 << GLIBTOP_PROC_TIME_IT_REAL_VALUE) +
|
||||
(1 << GLIBTOP_PROC_TIME_START_TIME);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_time_smp =
|
||||
(1 << GLIBTOP_PROC_TIME_XCPU_UTIME) + (1 << GLIBTOP_PROC_TIME_XCPU_STIME);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_time_s (glibtop *server)
|
||||
{
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time |
|
||||
_glibtop_sysdeps_proc_time_smp;
|
||||
#else
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
@@ -44,6 +52,7 @@ void
|
||||
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
|
||||
{
|
||||
char buffer [BUFSIZ], *p;
|
||||
int i;
|
||||
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
|
||||
|
||||
@@ -73,4 +82,24 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
|
||||
buf->frequency = 100;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_time;
|
||||
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
if (proc_file_to_buffer (buffer, "/proc/%d/cpu", pid))
|
||||
return;
|
||||
|
||||
p = skip_token (buffer);
|
||||
buf->utime = strtoul (p, &p, 0);
|
||||
buf->stime = strtoul (p, &p, 0);
|
||||
|
||||
for (i = 0; i < GLIBTOP_NCPU; i++) {
|
||||
if (strncmp (p+1, "cpu", 3) || !isdigit (p [4]))
|
||||
break;
|
||||
|
||||
p += 6;
|
||||
buf->xcpu_utime [i] = strtoul (p, &p, 0);
|
||||
buf->xcpu_stime [i] = strtoul (p, &p, 0);
|
||||
}
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_proc_time_smp;
|
||||
#endif
|
||||
}
|
||||
|
86
sysdeps/linux/sysinfo.c
Normal file
86
sysdeps/linux/sysinfo.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/sysinfo.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_sysinfo =
|
||||
(1 << GLIBTOP_SYSINFO_CPUINFO);
|
||||
|
||||
static glibtop_sysinfo sysinfo;
|
||||
|
||||
static void
|
||||
init_sysinfo (glibtop *server)
|
||||
{
|
||||
char buffer [BUFSIZ];
|
||||
static int init = 0;
|
||||
glibtop_entry *cpuinfo = NULL;
|
||||
FILE *f;
|
||||
|
||||
if (init) return;
|
||||
|
||||
init = TRUE;
|
||||
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
|
||||
|
||||
memset (&sysinfo, 0, sizeof (glibtop_sysinfo));
|
||||
|
||||
g_return_if_fail (f = fopen ("/proc/cpuinfo", "r"));
|
||||
|
||||
while (fgets (buffer, BUFSIZ, f)) {
|
||||
char *p, *key, *value;
|
||||
|
||||
if (cpuinfo == NULL) {
|
||||
cpuinfo = &sysinfo.cpuinfo [sysinfo.ncpu++];
|
||||
|
||||
cpuinfo->labels = g_ptr_array_new ();
|
||||
|
||||
cpuinfo->values = g_hash_table_new (NULL, NULL);
|
||||
|
||||
if (sysinfo.ncpu > GLIBTOP_NCPU)
|
||||
sysinfo.ncpu = GLIBTOP_NCPU;
|
||||
}
|
||||
|
||||
p = skip_token (buffer); *p = '\0';
|
||||
p = skip_token (p+1)+1;
|
||||
|
||||
p [strlen (p) ? strlen (p)-1 : 0] = '\0';
|
||||
|
||||
key = g_strdup (buffer);
|
||||
value = g_strdup (p);
|
||||
|
||||
g_ptr_array_add (cpuinfo->labels, key);
|
||||
|
||||
g_hash_table_insert (cpuinfo->values, key, value);
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
|
||||
sysinfo.flags = _glibtop_sysdeps_sysinfo;
|
||||
}
|
||||
|
||||
glibtop_sysinfo *
|
||||
glibtop_get_sysinfo_s (glibtop *server)
|
||||
{
|
||||
init_sysinfo (server);
|
||||
return &sysinfo;
|
||||
}
|
@@ -10,3 +10,6 @@ libgtop_names_la_SOURCES = cpu.c mem.c swap.c uptime.c loadavg.c \
|
||||
proctime.c procmem.c procsignal.c \
|
||||
prockernel.c procsegment.c fsusage.c \
|
||||
mountlist.c procmap.c
|
||||
|
||||
libgtop_names_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
|
@@ -7,11 +7,13 @@ lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
|
||||
libgtop_sysdeps_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_la_LIBADD = -lmach
|
||||
|
||||
libgtop_sysdeps_suid_la_SOURCES = open_suid.c close_suid.c proclist.c \
|
||||
procstate.c procuid.c proctime.c procmem.c \
|
||||
procsignal.c prockernel.c procsegment.c
|
||||
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_suid_la_LIBADD = -lmach
|
||||
|
||||
include_HEADERS = glibtop_server.h glibtop_machine.h
|
||||
|
@@ -10,3 +10,7 @@ libgtop_sysdeps_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procmap.c
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
include_HEADERS = glibtop_server.h
|
||||
|
||||
|
@@ -6,10 +6,14 @@ lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
|
||||
|
||||
libgtop_sysdeps_la_SOURCES = nosuid.c siglist.c
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c
|
||||
|
||||
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
include_HEADERS = glibtop_server.h glibtop_machine.h
|
||||
|
@@ -5,6 +5,7 @@ CFLAGS = -Wall -W @CFLAGS@
|
||||
lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
|
||||
|
||||
libgtop_sysdeps_la_SOURCES = nosuid.c siglist.c
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_la_LIBADD = -lkvm
|
||||
|
||||
libgtop_sysdeps_suid_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
@@ -12,6 +13,7 @@ libgtop_sysdeps_suid_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c
|
||||
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_suid_la_LIBADD = -lkvm
|
||||
|
||||
include_HEADERS = glibtop_server.h glibtop_machine.h
|
||||
|
Reference in New Issue
Block a user