Added I/O and IRQ wait time to glibtop_cpu. Closes #160443.
* examples/pprint.c: (pprint_get_cpu): * features.def: * include/glibtop/cpu.h: * sysdeps/linux/cpu.c: (glibtop_init_cpu_s), (glibtop_get_cpu_s): Added I/O and IRQ wait time to glibtop_cpu. Closes #160443. * configure.in: Post-release bump 2.9.4
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
||||
2005-01-03 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* examples/pprint.c: (pprint_get_cpu):
|
||||
* features.def:
|
||||
* include/glibtop/cpu.h:
|
||||
* sysdeps/linux/cpu.c: (glibtop_init_cpu_s), (glibtop_get_cpu_s):
|
||||
Added I/O and IRQ wait time to glibtop_cpu. Closes #160443.
|
||||
|
||||
* configure.in: Post-release bump 2.9.4
|
||||
|
||||
2004-12-29 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* lib/read_data.c: (glibtop_read_data_l):
|
||||
|
@@ -8,7 +8,7 @@ AC_CANONICAL_SYSTEM
|
||||
|
||||
LIBGTOP_MAJOR_VERSION=2
|
||||
LIBGTOP_MINOR_VERSION=9
|
||||
LIBGTOP_MICRO_VERSION=3
|
||||
LIBGTOP_MICRO_VERSION=4
|
||||
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
|
||||
AM_INIT_AUTOMAKE(libgtop, $LIBGTOP_VERSION)
|
||||
|
||||
|
@@ -41,12 +41,18 @@ static void pprint_get_cpu()
|
||||
PPRINT(nice, "%llu");
|
||||
PPRINT(sys, "%llu");
|
||||
PPRINT(idle, "%llu");
|
||||
PPRINT(iowait, "%llu");
|
||||
PPRINT(irq, "%llu");
|
||||
PPRINT(softirq, "%llu");
|
||||
PPRINT(frequency, "%llu");
|
||||
PPRINT_ARRAY(xcpu_total, GLIBTOP_NCPU, "%llu");
|
||||
PPRINT_ARRAY(xcpu_user, GLIBTOP_NCPU, "%llu");
|
||||
PPRINT_ARRAY(xcpu_nice, GLIBTOP_NCPU, "%llu");
|
||||
PPRINT_ARRAY(xcpu_sys, GLIBTOP_NCPU, "%llu");
|
||||
PPRINT_ARRAY(xcpu_idle, GLIBTOP_NCPU, "%llu");
|
||||
PPRINT_ARRAY(xcpu_iowait, GLIBTOP_NCPU, "%llu");
|
||||
PPRINT_ARRAY(xcpu_irq, GLIBTOP_NCPU, "%llu");
|
||||
PPRINT_ARRAY(xcpu_softirq, GLIBTOP_NCPU, "%llu");
|
||||
PPRINT(xcpu_flags, "%llx");
|
||||
FOOTER_PPRINT();
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
void|cpu|ulong(total,user,nice,sys,idle,frequency,xcpu_total[4],xcpu_user[4],xcpu_nice[4],xcpu_sys[4],xcpu_idle[4])
|
||||
void|cpu|ulong(total,user,nice,sys,idle,iowait,irq,softirq,frequency,xcpu_total[4],xcpu_user[4],xcpu_nice[4],xcpu_sys[4],xcpu_idle[4],xcpu_iowait[4],xcpu_irq[4],xcpu_softirq[4])
|
||||
void|mem|ulong(total,used,free,shared,buffer,cached,user,locked)
|
||||
void|swap|ulong(total,used,free,pagein,pageout)
|
||||
void|uptime|double(uptime,idletime)
|
||||
|
@@ -41,9 +41,16 @@ G_BEGIN_DECLS
|
||||
#define GLIBTOP_XCPU_NICE 8
|
||||
#define GLIBTOP_XCPU_SYS 9
|
||||
#define GLIBTOP_XCPU_IDLE 10
|
||||
#define GLIBTOP_XCPU_FLAGS 11
|
||||
#define GLIBTOP_XCPU_FLAGS 11
|
||||
|
||||
#define GLIBTOP_MAX_CPU 12
|
||||
#define GLIBTOP_CPU_IOWAIT 12
|
||||
#define GLIBTOP_CPU_IRQ 13
|
||||
#define GLIBTOP_CPU_SOFTIRQ 14
|
||||
#define GLIBTOP_XCPU_IOWAIT 15
|
||||
#define GLIBTOP_XCPU_IRQ 16
|
||||
#define GLIBTOP_XCPU_SOFTIRQ 17
|
||||
|
||||
#define GLIBTOP_MAX_CPU 18
|
||||
|
||||
/* Nobody should really be using more than 4 processors. */
|
||||
#define GLIBTOP_NCPU 4
|
||||
@@ -58,12 +65,18 @@ struct _glibtop_cpu
|
||||
nice, /* GLIBTOP_CPU_NICE */
|
||||
sys, /* GLIBTOP_CPU_SYS */
|
||||
idle, /* GLIBTOP_CPU_IDLE */
|
||||
iowait, /* GLIBTOP_CPU_IOWAIT */
|
||||
irq, /* GLIBTOP_CPU_IRQ */
|
||||
softirq, /* GLIBTOP_CPU_SOFTIRQ */
|
||||
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 */
|
||||
xcpu_iowait [GLIBTOP_NCPU], /* GLIBTOP_XCPU_IOWAIT */
|
||||
xcpu_irq [GLIBTOP_NCPU], /* GLIBTOP_XCPU_IRQ */
|
||||
xcpu_softirq [GLIBTOP_NCPU], /* GLIBTOP_XCPU_SOFTIRQ */
|
||||
xcpu_flags; /* GLIBTOP_XCPU_IDLE */
|
||||
};
|
||||
|
||||
|
@@ -37,6 +37,14 @@ static const unsigned long _glibtop_sysdeps_cpu_smp =
|
||||
(1L << GLIBTOP_XCPU_NICE) + (1L << GLIBTOP_XCPU_SYS) +
|
||||
(1L << GLIBTOP_XCPU_IDLE);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu_2_6 =
|
||||
(1L << GLIBTOP_CPU_IOWAIT) + (1L << GLIBTOP_CPU_IRQ) +
|
||||
(1L << GLIBTOP_CPU_SOFTIRQ);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu_smp_2_6 =
|
||||
(1L << GLIBTOP_XCPU_IOWAIT) + (1L << GLIBTOP_XCPU_IRQ) +
|
||||
(1L << GLIBTOP_XCPU_SOFTIRQ);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
@@ -46,6 +54,15 @@ glibtop_init_cpu_s (glibtop *server)
|
||||
|
||||
if (server->ncpu)
|
||||
server->sysdeps.cpu |= _glibtop_sysdeps_cpu_smp;
|
||||
|
||||
|
||||
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0))
|
||||
{
|
||||
server->sysdeps.cpu |= _glibtop_sysdeps_cpu_2_6;
|
||||
|
||||
if (server->ncpu)
|
||||
server->sysdeps.cpu |= _glibtop_sysdeps_cpu_smp_2_6;
|
||||
}
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
@@ -76,9 +93,15 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
buf->idle = strtoull (p, &p, 0);
|
||||
|
||||
/* 2.6 kernel */
|
||||
buf->idle += strtoull(p, &p, 0); /* "iowait" */
|
||||
buf->sys += strtoull(p, &p, 0); /* "irq" */
|
||||
buf->sys += strtoull(p, &p, 0); /* "softirq" */
|
||||
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0))
|
||||
{
|
||||
buf->iowait = strtoull(p, &p, 0);
|
||||
buf->irq = strtoull(p, &p, 0);
|
||||
buf->softirq = strtoull(p, &p, 0);
|
||||
|
||||
buf->idle += buf->iowait;
|
||||
buf->sys += buf->irq + buf->softirq;
|
||||
}
|
||||
|
||||
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
|
||||
|
||||
@@ -104,9 +127,15 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
buf->xcpu_idle [i] = strtoull (p, &p, 0);
|
||||
|
||||
/* 2.6 kernel */
|
||||
buf->xcpu_idle [i] += strtoull(p, &p, 0); /* "iowait" */
|
||||
buf->xcpu_sys [i] += strtoull(p, &p, 0); /* "irq" */
|
||||
buf->xcpu_sys [i] += strtoull(p, &p, 0); /* "softirq" */
|
||||
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0))
|
||||
{
|
||||
buf->xcpu_iowait [i] = strtoull(p, &p, 0);
|
||||
buf->xcpu_irq [i] = strtoull(p, &p, 0);
|
||||
buf->xcpu_softirq [i] = strtoull(p, &p, 0);
|
||||
|
||||
buf->xcpu_idle [i] += buf->xcpu_iowait [i];
|
||||
buf->xcpu_sys [i] += buf->xcpu_irq [i] + buf->xcpu_softirq [i];
|
||||
}
|
||||
|
||||
buf->xcpu_total[i] = buf->xcpu_user [i] \
|
||||
+ buf->xcpu_nice [i] \
|
||||
@@ -116,4 +145,12 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
|
||||
if(i >= 2) /* ok, that's a real SMP */
|
||||
buf->flags |= _glibtop_sysdeps_cpu_smp;
|
||||
|
||||
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0))
|
||||
{
|
||||
buf->flags |= _glibtop_sysdeps_cpu_2_6;
|
||||
|
||||
if(i >= 2) /* ok, that's a real SMP */
|
||||
buf->flags |= _glibtop_sysdeps_cpu_smp_2_6;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user