class OSStatus

This class implements an abstract interface to certain system parameters like the system load or the memory usage. More...

Definition#include <whatsup/OSStatus.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Private Methods

Private Members


Detailed Description

This class implements an abstract interface to certain system parameters like the system load or the memory usage. The information can be retrieved with member functions of this class.

 OSStatus ()

OSStatus

 ~OSStatus ()

~OSStatus

bool  ok (void)

ok

[const]

If an error has occured the return value of this function will be false, true otherwise.

const QString&  getErrMessage (void)

getErrMessage

[const]

If an error has occured the functions return an error message. If no error has occured it returns an empty string.

bool  getCpuLoad (int& user, int& sys, int& nice, int& idle)

getCpuLoad

This function calculates the overall system load. The load is split into user, system, nice and idle load. The values are in percent (0 - 100). If an error occured the return value is false, otherwise true.

int  getCpuCount (void)

getCpuCount

This function returns the number of CPUs installed. It must be called before the first call to getCpuXLoad!

bool  getCpuXLoad (int cpu, int& user, int& sys, int& nice, int& idle)

getCpuXLoad

This function calculates the load for CPU 'cpu'. The load is split into user, system, nice and idle load. The values are in percent (0 - 100). If an error occured the return value is false, otherwise true.

bool  getMemoryInfo (int& mtotal, int& mfree, int& used, int& buffers, int& cached)

getMemoryInfo

This function determines the memory usage of the system. All values are for physical memory only. If an error occured the return value is false, otherwise true. All values are in kBytes.

bool  getSwapInfo (int& stotal, int& sfree)

getSwapInfo

This function deterines the total swap space size and the used swap space size. If an error occured the return value is false, otherwise true. All values are in kBytes.

int  getNoProcesses (void)

getNoProcesses

This functions returns the number of processes that are currently running on the system.

bool  readCpuInfo (const char* cpu, int* u, int* s, int* n, int* i)

readCpuInfo

[private]

This function reads the information for the cpu 'cpu'. This can be "cpu" or "cpu0", "cpu1" etc. on SMP systems.

int cpuCount

cpuCount

[private]

int userTicks

userTicks

[private]

int sysTicks

sysTicks

[private]

int niceTicks

niceTicks

[private]

int idleTicks

idleTicks

[private]

int* userTicksX

userTicksX

[private]

int* sysTicksX

sysTicksX

[private]

int* niceTicksX

niceTicksX

[private]

int* idleTicksX

idleTicksX

[private]

struct tbl_sysinfo * si

si

[private]

FILE* stat

stat

[private]

kstat_ctl_t * kstat_control

kstat_control

[private]

long pagefactor

pagefactor

[private]

vminfo_t swap_info

swap_info

[private]

hrtime_t ks_time

ks_time

[private]

unsigned long * cpu_info

cpu_info

[private]

int * last_user

last_user

[private]

int * last_sys

last_sys

[private]

And now the same again for SMP systems. The arrays are allocated when needed.

int * last_idle

last_idle

[private]

And now the same again for SMP systems. The arrays are allocated when needed.

int * last_wait

last_wait

[private]

And now the same again for SMP systems. The arrays are allocated when needed.

bool error

error

[private]

QString errMessage

errMessage

[private]


Generated by: andreas on linux on Sat Jun 15 19:28:49 2002, using kdoc 2.0a53.