Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sg_get_fs_stats(3) [debian man page]

sg_get_fs_stats(3)					     Library Functions Manual						sg_get_fs_stats(3)

NAME
sg_get_fs_stats - get filesystem statistics SYNOPSIS
#include <statgrab.h> sg_fs_stats *sg_get_fs_stats(int *entries); DESCRIPTION
The sg_get_fs_stats takes a pointer to an int, entries, which is filled with the number of mounted file systems the machine has. The return value is a pointer to the first member of an array of sg_fs_stats structures; the number of entries in the array is returned in entries. The function returns statistics about mounted filesystems, including free space and inode usage. RETURN VALUES
sg_get_fs_stats returns a pointer to a structure of type sg_fs_stats. typedef struct { char *device_name; char *fs_type; char *mnt_point; long long size; long long used; long long avail; long long total_inodes; long long used_inodes; long long free_inodes; long long avail_inodes; long long io_size; long long block_size; long long total_blocks; long long free_blocks; long long used_blocks; long long avail_blocks; } sg_fs_stats; device_name The name known to the operating system. (eg. on linux it might be hda) fs_type The type of the filesystem. mnt_point The mount point of the file system. size The size, in bytes, of the file system. used The amount of space, in bytes, used on the filesystem. avail The amount of space, in bytes, available on the filesystem. total_inodes The total number of inodes in the filesystem. used_inodes The number of used inodes in the filesystem. free_inodes The number of free inodes in the filesystem. avail_inodes The number of free inodes available to non-privileged processes. io_size A suggested optimal block size for IO operations -- if you're reading or writing lots of data, do it in chunks of this size. block_size How big blocks actually are on the underlying filesystem (typically for purposes of stats reporting). total_blocks The total number of blocks in the filesystem. free_blocks The number of free blocks in the filesystem. used_blocks The number of used blocks in the filesystem. avail_blocks The number of free blocks available to non-privileged processes. SEE ALSO
statgrab(3) WEBSITE
http://www.i-scream.org/libstatgrab/ i-scream $Date: 2005/07/13 13:01:23 $ sg_get_fs_stats(3)

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