From a331fb8e03c4ea9dcffdd6fb4ff527797776e0a3 Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Wed, 9 Sep 1998 15:19:24 +0000 Subject: [PATCH] Added `ncpu'. This is zero for single processor systems and the number of 1998-09-09 Martin Baulig * 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. --- ChangeLog | 9 +++++++++ glibtop.h | 1 + include/glibtop/cpu.h | 28 +++++++++++++++++++++------- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5469e791..fd200bda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +1998-09-09 Martin Baulig + + * 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 * configure.in: Make the default to disable guile. diff --git a/glibtop.h b/glibtop.h index 6a32ae69..fa823375 100644 --- a/glibtop.h +++ b/glibtop.h @@ -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 */ diff --git a/include/glibtop/cpu.h b/include/glibtop/cpu.h index 7c1fcbbd..884b5fcf 100644 --- a/include/glibtop/cpu.h +++ b/include/glibtop/cpu.h @@ -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)