| Libgtop Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <glibtop/cpu.h> #define GLIBTOP_CPU_TOTAL #define GLIBTOP_CPU_USER #define GLIBTOP_CPU_NICE #define GLIBTOP_CPU_SYS #define GLIBTOP_CPU_IDLE #define GLIBTOP_CPU_FREQUENCY #define GLIBTOP_XCPU_TOTAL #define GLIBTOP_XCPU_USER #define GLIBTOP_XCPU_NICE #define GLIBTOP_XCPU_SYS #define GLIBTOP_XCPU_IDLE #define GLIBTOP_XCPU_FLAGS #define GLIBTOP_CPU_IOWAIT #define GLIBTOP_CPU_IRQ #define GLIBTOP_CPU_SOFTIRQ #define GLIBTOP_XCPU_IOWAIT #define GLIBTOP_XCPU_IRQ #define GLIBTOP_XCPU_SOFTIRQ #define GLIBTOP_MAX_CPU #define GLIBTOP_NCPU glibtop_cpu; void glibtop_get_cpu (glibtop_cpu *buf); #define glibtop_get_cpu_r void glibtop_get_cpu_l (glibtop *server, glibtop_cpu *buf); void glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf); void glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf);
typedef struct {
guint64 flags;
guint64 total; /* GLIBTOP_CPU_TOTAL */
guint64 user; /* GLIBTOP_CPU_USER */
guint64 nice; /* GLIBTOP_CPU_NICE */
guint64 sys; /* GLIBTOP_CPU_SYS */
guint64 idle; /* GLIBTOP_CPU_IDLE */
guint64 iowait; /* GLIBTOP_CPU_IOWAIT */
guint64 irq; /* GLIBTOP_CPU_IRQ */
guint64 softirq; /* GLIBTOP_CPU_SOFTIRQ */
guint64 frequency; /* GLIBTOP_CPU_FREQUENCY */
guint64 xcpu_total [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_TOTAL */
guint64 xcpu_user [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_USER */
guint64 xcpu_nice [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_NICE */
guint64 xcpu_sys [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_SYS */
guint64 xcpu_idle [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IDLE */
guint64 xcpu_iowait [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IOWAIT */
guint64 xcpu_irq [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IRQ */
guint64 xcpu_softirq [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_SOFTIRQ */
guint64 xcpu_flags; /* GLIBTOP_XCPU_IDLE */
} glibtop_cpu;
void glibtop_get_cpu (glibtop_cpu *buf);
Get the CPU usage.
All CPU units are measured in jiffies which are normally 1/100th of a second (in which case frequency equals 100), but can also be in any other unit. To get seconds, divide them by frequency.
|
A location to return the CPU usage. |