CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
sysinfo.h File Reference

Processor, memory and I/O statistics for the machine and for individual processes. More...

#include <cx/cx.h>
#include <cx/sys/process.h>

Go to the source code of this file.

Data Structures

struct  SysMemInfo
 How much memory the machine has and how much of it is spoken for. More...
 
struct  SysCPUTimes
 
struct  SysUptime
 How long the machine has been running. More...
 
struct  SysLoadAvg
 
struct  ProcMemInfo
 How much memory one process is using. More...
 
struct  ProcCPUTimes
 Processor time one process has used since it started. More...
 
struct  ProcIOInfo
 
struct  SysCPUSampler
 Remembers the previous reading so repeated polling needs only one call each time. More...
 
struct  ProcCPUSampler
 

Macros

#define sysCPUSamplerInit(s)   memset((s), 0, sizeof(SysCPUSampler))
 
#define procCPUSamplerInit(s)   memset((s), 0, sizeof(ProcCPUSampler))
 

Typedefs

typedef struct SysMemInfo SysMemInfo
 How much memory the machine has and how much of it is spoken for.
 
typedef struct SysCPUTimes SysCPUTimes
 
typedef struct SysUptime SysUptime
 How long the machine has been running.
 
typedef struct SysLoadAvg SysLoadAvg
 
typedef struct ProcMemInfo ProcMemInfo
 How much memory one process is using.
 
typedef struct ProcCPUTimes ProcCPUTimes
 Processor time one process has used since it started.
 
typedef struct ProcIOInfo ProcIOInfo
 
typedef struct SysCPUSampler SysCPUSampler
 Remembers the previous reading so repeated polling needs only one call each time.
 
typedef struct ProcCPUSampler ProcCPUSampler
 

Enumerations

enum  SysMemInfoValid { SYSMEM_Phys = 0x0001 , SYSMEM_Commit = 0x0002 , SYSMEM_Swap = 0x0004 , SYSMEM_PageSize = 0x0008 }
 Which fields of a SysMemInfo the operating system reported. More...
 
enum  SysCPUTimesValid {
  SYSCPU_User = 0x0001 , SYSCPU_System = 0x0002 , SYSCPU_Idle = 0x0004 , SYSCPU_IOWait = 0x0008 ,
  SYSCPU_IRQ = 0x0010 , SYSCPU_Steal = 0x0020
}
 Which breakdown fields of a SysCPUTimes the operating system reported. More...
 
enum  SysUptimeValid { SYSUP_Uptime = 0x0001 , SYSUP_BootTime = 0x0002 }
 Which fields of a SysUptime the operating system reported. More...
 
enum  SysLoadAvgValid { SYSLOAD_Load1 = 0x0001 , SYSLOAD_Load5 = 0x0002 , SYSLOAD_Load15 = 0x0004 }
 Which fields of a SysLoadAvg the operating system reported. More...
 
enum  ProcMemInfoValid {
  PROCMEM_Resident = 0x0001 , PROCMEM_PeakResident = 0x0002 , PROCMEM_Virtual = 0x0004 , PROCMEM_PeakVirtual = 0x0008 ,
  PROCMEM_Private = 0x0010 , PROCMEM_Swapped = 0x0020
}
 Which fields of a ProcMemInfo the operating system reported. More...
 
enum  ProcCPUTimesValid { PROCCPU_User = 0x0001 , PROCCPU_System = 0x0002 , PROCCPU_Started = 0x0004 }
 Which fields of a ProcCPUTimes the operating system reported. More...
 
enum  ProcIOInfoValid { PROCIO_Bytes = 0x0001 , PROCIO_Ops = 0x0002 , PROCIO_Other = 0x0004 }
 Which fields of a ProcIOInfo the operating system reported. More...
 

Functions

bool sysMemInfo (SysMemInfo *out)
 
bool sysCPUTimes (SysCPUTimes *out)
 
bool sysUptime (SysUptime *out)
 
bool sysLoadAvg (SysLoadAvg *out)
 
float64 sysCPUUsage (const SysCPUTimes *first, const SysCPUTimes *second)
 
bool sysCPUSample (SysCPUSampler *s, float64 *pct)
 
bool procMemInfo (ProcMemInfo *out, Process *proc)
 
bool procMemInfoByID (ProcMemInfo *out, ProcessID pid)
 
bool procCPUTimes (ProcCPUTimes *out, Process *proc)
 
bool procCPUTimesByID (ProcCPUTimes *out, ProcessID pid)
 
bool procIOInfo (ProcIOInfo *out, Process *proc)
 
bool procIOInfoByID (ProcIOInfo *out, ProcessID pid)
 
float64 procCPUUsage (const ProcCPUTimes *first, const ProcCPUTimes *second)
 
bool procCPUSample (ProcCPUSampler *s, Process *proc, float64 *pct)
 

Detailed Description

Processor, memory and I/O statistics for the machine and for individual processes.

Definition in file sysinfo.h.