Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

statgrab(1) [debian man page]

statgrab(1)						      General Commands Manual						       statgrab(1)

NAME
statgrab - sysctl-style interface to system statistics SYNOPSIS
statgrab [OPTION]... [STAT]... DESCRIPTION
statgrab provides a sysctl-style interface to all the system statistics available through libstatgrab. This is useful for applications that don't want to make library calls, but still want to access the statistics. An example of such an application is mrtg, for which scripts are provided to generate configuration files. OPTIONS
The following options are supported. -l Linux sysctl-style output (default) -b BSD sysctl-style output -m MRTG-compatible output -u Plain output (only show values) -n Display cumulative stats once (default) -s Display stat differences repeatedly -o Display stat differences once -t DELAY When repeating, wait DELAY seconds between updates (default 1) -p Display CPU usage differences as percentages rather than absolute values -f FACTOR Display floating-point values as integers scaled by FACTOR -K Display byte counts in kibibytes -M Display byte counts in mebibytes -G Display byte counts in gibibytes If no STAT options are given, all will be displayed. Specify 'STAT.' to display all statistics starting with that prefix. SEE ALSO
statgrab-make-mrtg-config(1) statgrab-make-mrtg-index(1) saidar(1) statgrab(3) AUTHORS
This man page was derived from the man page written by Bartosz Fenski for the Debian GNU/Linux distribution. WEBSITE
http://www.i-scream.org/libstatgrab/ i-scream $Date: 2005/04/25 12:37:22 $ statgrab(1)

Check Out this Related Man Page

sg_get_cpu_stats(3)					     Library Functions Manual					       sg_get_cpu_stats(3)

NAME
sg_get_cpu_stats, sg_get_cpu_stats_diff, sg_get_cpu_percents - get cpu usage SYNOPSIS
#include <statgrab.h> sg_cpu_percents *sg_get_cpu_percents(void); sg_cpu_stats *sg_get_cpu_stats(void); sg_cpu_stats *sg_get_cpu_stats_diff(void); DESCRIPTION
sg_get_cpu_stats() and sg_get_cpu_stats_diff() both return static pointers of type sg_cpu_stats. sg_get_cpu_stats() returns the total amount of "ticks" the operating system has spent in each of the different states. sg_get_cpu_stats_diff() returns the difference in "ticks" for each of the states since last time sg_get_cpu_stats_diff() or sg_get_cpu_stats() was called. If it has never been called, it will return the result of sg_get_cpu_stats(). The value stored (the "ticks") will vary between operating systems. For example Solaris has a total of 100 per second, while Linux has sub- stantially more. Also, different operating systems store different information - you won't find nice cpu on Solaris for example. Because of this, you will ideally always want to work on a scale against the total, or in percentages. sg_get_cpu_percents() returns a pointer to a static sg_cpu_percents. The function calls sg_get_cpu_stats_diff() and changes the values into percentages. If it has never been called before (and nor has sg_get_cpu_stats() or sg_get_cpu_stats_diff()), the returned percentages will be the systems total ever since its uptime. (Unless the counters have cycled) RETURN VALUES
There are two structures returned by the CPU statistics functions. typedef struct{ long long user; long long kernel; long long idle; long long iowait; long long swap; long long nice; long long total; time_t systime; }sg_cpu_stats; typedef struct{ float user; float kernel; float idle; float iowait; float swap; float nice; time_t time_taken; }sg_cpu_percents; user kernel idle iowait swap nice The different CPU states. systime time_taken The time taken in seconds since the last call of the function, or the system time. SEE ALSO
statgrab(3) WEBSITE
http://www.i-scream.org/libstatgrab/ i-scream $Date: 2005/04/25 11:25:45 $ sg_get_cpu_stats(3)
Man Page