cpu

## cpu cpu |

## Functions

void | glibtop_get_cpu ()
void | glibtop_get_cpu_l ()
void | glibtop_get_cpu_p ()
void | glibtop_get_cpu_s ()

## Types and Values

#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
struct | glibtop_cpu
#define | glibtop_get_cpu_r

## Includes

    #include <glibtop/cpu.h>

## Description

## Functions

### glibtop_get_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.

#### Parameters

buf | A location to return the CPU usage. |

### glibtop_get_cpu_l ()

    void
    glibtop_get_cpu_l (glibtop *server,
                       glibtop_cpu *buf);

### glibtop_get_cpu_p ()

    void
    glibtop_get_cpu_p (glibtop *server,
                       glibtop_cpu *buf);

### glibtop_get_cpu_s ()

    void
    glibtop_get_cpu_s (glibtop *server,
                       glibtop_cpu *buf);

## Types and Values

### GLIBTOP_CPU_TOTAL

    #define GLIBTOP_CPU_TOTAL 0

### GLIBTOP_CPU_USER

    #define GLIBTOP_CPU_USER 1

### GLIBTOP_CPU_NICE

    #define GLIBTOP_CPU_NICE 2

### GLIBTOP_CPU_SYS

    #define GLIBTOP_CPU_SYS		3

### GLIBTOP_CPU_IDLE

    #define GLIBTOP_CPU_IDLE 4

### GLIBTOP_CPU_FREQUENCY

    #define GLIBTOP_CPU_FREQUENCY 5

### GLIBTOP_XCPU_TOTAL

    #define GLIBTOP_XCPU_TOTAL 6

### GLIBTOP_XCPU_USER

    #define GLIBTOP_XCPU_USER 7

### GLIBTOP_XCPU_NICE

    #define GLIBTOP_XCPU_NICE 8

### GLIBTOP_XCPU_SYS

    #define GLIBTOP_XCPU_SYS 9

### GLIBTOP_XCPU_IDLE

    #define GLIBTOP_XCPU_IDLE 10

### GLIBTOP_XCPU_FLAGS

    #define GLIBTOP_XCPU_FLAGS 11

### GLIBTOP_CPU_IOWAIT

    #define GLIBTOP_CPU_IOWAIT 12

### GLIBTOP_CPU_IRQ

    #define GLIBTOP_CPU_IRQ		13

### GLIBTOP_CPU_SOFTIRQ

    #define GLIBTOP_CPU_SOFTIRQ 14

### GLIBTOP_XCPU_IOWAIT

    #define GLIBTOP_XCPU_IOWAIT 15

### GLIBTOP_XCPU_IRQ

    #define GLIBTOP_XCPU_IRQ 16

### GLIBTOP_XCPU_SOFTIRQ

    #define GLIBTOP_XCPU_SOFTIRQ 17

### GLIBTOP_MAX_CPU

    #define GLIBTOP_MAX_CPU		18

### GLIBTOP_NCPU

    #define GLIBTOP_NCPU		1024

### struct glibtop_cpu

    struct glibtop_cpu {
    	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_get_cpu_r

    #define glibtop_get_cpu_r glibtop_get_cpu_p