Unconditionally enable SMP support for linux.
1999-01-06 Martin Baulig <martin@home-of-linux.org> Unconditionally enable SMP support for linux. * open.c (_glibtop_open_s): Always determine the number of CPUs we have here, not only when SMP support was enabled. * cpu.c, proctime.c: Use `server->ncpu' to determine whether to enable SMP support.
This commit is contained in:
committed by
Martin Baulig
parent
688e65fbec
commit
e491343151
@@ -1,3 +1,13 @@
|
||||
1999-01-06 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Unconditionally enable SMP support for linux.
|
||||
|
||||
* open.c (_glibtop_open_s): Always determine the number of CPUs
|
||||
we have here, not only when SMP support was enabled.
|
||||
|
||||
* cpu.c, proctime.c: Use `server->ncpu' to determine whether to
|
||||
enable SMP support.
|
||||
|
||||
1998-12-28 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* netload.c: When using glibc, don't include <netinet/ip_fw.h>
|
||||
|
@@ -38,11 +38,10 @@ static const unsigned long _glibtop_sysdeps_cpu_smp =
|
||||
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
|
||||
|
||||
if (server->ncpu)
|
||||
server->sysdeps.cpu |= _glibtop_sysdeps_cpu_smp;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
@@ -83,8 +82,7 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
buf->frequency = 100;
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
for (i = 0; i < GLIBTOP_NCPU; i++) {
|
||||
for (i = 0; i < server->ncpu; i++) {
|
||||
if (strncmp (p+1, "cpu", 3) || !isdigit (p [4]))
|
||||
break;
|
||||
|
||||
@@ -99,5 +97,4 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
}
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_cpu_smp;
|
||||
#endif
|
||||
}
|
||||
|
@@ -59,10 +59,8 @@ 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;
|
||||
|
||||
@@ -71,7 +69,6 @@ glibtop_open_s (glibtop *server, const char *program_name,
|
||||
|
||||
server->ncpu = 0;
|
||||
|
||||
#ifdef HAVE_LIBGTOP_SMP
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd < 0)
|
||||
glibtop_error_io_r (server, "open (%s)", FILENAME);
|
||||
@@ -99,6 +96,4 @@ glibtop_open_s (glibtop *server, const char *program_name,
|
||||
#if DEBUG
|
||||
printf ("\nThis machine has %d CPUs.\n\n", server->ncpu);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@@ -38,12 +38,10 @@ static const unsigned long _glibtop_sysdeps_proc_time_smp =
|
||||
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
|
||||
|
||||
if (server->ncpu)
|
||||
server->sysdeps.proc_time |= _glibtop_sysdeps_proc_time_smp;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
@@ -83,7 +81,9 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_time;
|
||||
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
if (!server->ncpu)
|
||||
return;
|
||||
|
||||
if (proc_file_to_buffer (buffer, "/proc/%d/cpu", pid))
|
||||
return;
|
||||
|
||||
@@ -101,5 +101,4 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
|
||||
}
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_proc_time_smp;
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user