NAME

lkmi_system


SYNOPSIS

#include <lkmi.h >

int lkmi_system (lkmi_system_t *sys_info);


PARAMETERS

sys_info
Contain pointer to the structure which is described below.


DESCRIPTION

lkmi_system obtains system activity informations from /proc/stat, /proc/loadavg and /proc/uptime files and puts it in lkmi_system_t structure. This data is about system activity, disk activity, system load and more.

All counters contains summary values from system boot.

CPU State
This values are counted over all CPUs.

user
Number of jiffies in the user state.

nice
Number of jiffies with nice priority.

system
Number of jiffies in the system state.

idle
Number of jiffies in the idle state.

Paging part
Showing paging activity:

pages_in
Number of pages the system paged in.

pages_out
Number of pages the system paged out (from disk).

Swap part
Showing swap activity:

swap_in
Number of pages the system paged in.

swap_out
Number of pages the system paged out (from disk).

Context
This section contains only one counter,

ctxt
which is number of context switches from system boot.

System Load and other
This part contains average loads and time or run queue length. And other time related informations.

btime
Boot time, in seconds since the epoch (January 1, 1970).

uptime
The uptime of the system (seconds).

_1min
Average load (run queue length) for last minute.

_5min
Average load for last 5 minutes.

_15min
Average load for last 15 minutes.


RETURN VALUE

If function ends successfully (partially successfull), then returns 0. If errno is set to 0 then all counters was retrieved successfully. If errno is set to ENOENT some partial counters are not filled, unfilled value is -1.

If call fails, functions returns -1 and sets errno value to:

ENOENT
If one of required files is not exist. f.e. proc file-system is not included in kernel or not mounted to /proc directory.

EINVAL
NULL pointer is assigned as parameter sys_info.

ENOMEM
Not enough memory for temporary purposes (During data files parsing).

The lkmi_system function may also failed and set errno for any of the errors specified for the routine fopen(3).


BUGS REPORTING

Please use the SourceForge Reporting page which is located here:

Bug Report


COPYRIGHT

This function is written as part of lkmi library for Linux system and may be freely distributed under GPL terms.

Copyright (c) 1995, 2002 David Doubrava (linux_monitor(at)volny(dot)cz).


SEE ALSO

Origin of values description is in Linux kernel source.

lkmi, lkmi_cpu, lkmi_files, lkmi_filesys, lkmi_hdd, lkmi_hw_intr, lkmi_inodes, lkmi_memory, lkmi_memoryswap, lkmi_net, lkmi_proc, lkmi_readprocesses, lkmi_swap, lkmi_swapex, lkmi_system