sg_get_cpu_stats_diff_between man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

sg_get_cpu_stats(3)					   sg_get_cpu_stats(3)

NAME
       sg_get_cpu_stats,       sg_get_cpu_stats_r,	sg_get_cpu_stats_diff,
       sg_get_cpu_stats_diff_between,	sg_get_cpu_percents,   sg_get_cpu_per‐
       cents_of, sg_get_cpu_percents_r, sg_free_cpu_stats - get cpu usage

SYNOPSIS
       #include <statgrab.h>

       sg_cpu_percents *sg_get_cpu_percents (size_t *entries);

       sg_cpu_percents *sg_get_cpu_percents_of (sg_cpu_percent_source cps,
		       size_t *entries);

       sg_cpu_percents *sg_get_cpu_percents_r (const sg_cpu_stats *whereof,
					      size_t *entries);

       void sg_free_cpu_percents (sg_cpu_percents *data);

       sg_cpu_stats *sg_get_cpu_stats (size_t *entries);

       sg_cpu_stats *sg_get_cpu_stats_diff (size_t *entries);

       sg_cpu_stats *sg_get_cpu_stats_r (size_t *entries);

       sg_cpu_stats *sg_get_cpu_stats_diff_between (const sg_cpu_stats
		       *cpu_now, const sg_cpu_stats *cpu_last, size_t
		       *entries);

       sg_error sg_free_cpu_stats (sg_cpu_stats *data);

DESCRIPTION
       These  are  the	categories  of data delivered by the cpu stats module:
       sg_get_cpu_stats() and sg_get_cpu_stats_r() deliver native cpu counters
       since   the  machine  has  been	started,  sg_get_cpu_stats_diff()  and
       sg_get_cpu_stats_diff_between() deliver native cpu counters between two
       sg_get_cpu_stats()     calls	and    sg_get_cpu_percents_of()	   and
       sg_get_cpu_percents_r() deliver correlated relative cpu counters (where
       total is 100%).

       API Shortcut

       ┌──────────────────────────┬───────────────────┬─────────────────────┐
       │function		  │ returns	      │ data owner	    │
       ├──────────────────────────┼───────────────────┼─────────────────────┤
       │sg_get_cpu_stats	  │ sg_cpu_stats *    │ libstatgrab (thread │
       │			  │		      │ local)		    │
       ├──────────────────────────┼───────────────────┼─────────────────────┤
       │sg_get_cpu_stats_r	  │ sg_cpu_stats *    │ caller		    │
       ├──────────────────────────┼───────────────────┼─────────────────────┤
       │sg_get_cpu_stats_diff	  │ sg_cpu_stats *    │ libstatgrab (thread │
       │			  │		      │ local)		    │
       ├──────────────────────────┼───────────────────┼─────────────────────┤
       │sg_get_cpu_stats_diff_be‐ │ sg_cpu_stats *    │ caller		    │
       │tween			  │		      │			    │
       ├──────────────────────────┼───────────────────┼─────────────────────┤
       │sg_get_cpu_percents_of	  │ sg_cpu_percents * │ libstatgrab (thread │
       │			  │		      │ local)		    │
       ├──────────────────────────┼───────────────────┼─────────────────────┤
       │sg_get_cpu_percents_r	  │ sg_cpu_percents * │ caller		    │
       └──────────────────────────┴───────────────────┴─────────────────────┘
       The sg_cpu_stats buffer	received  from	sg_get_cpu_stats_r()  and  the
       sg_get_cpu_stats_diff_between()	as  well as the sg_cpu_percents buffer
       received	  from	 sg_get_cpu_percents_r()   must	  be	freed	 using
       sg_free_cpu_stats()  or	the sg_free_cpu_percents(), respectively, when
       not needed any more. The caller is responsible for doing it.

       The value stored (the "ticks") will vary between operating systems. For
       example Solaris has a total of 100 per second, while Linux has substan‐
       tially more. Also, different operating systems store different informa‐
       tion - you won't find nice cpu on Solaris for example.

       Modern  systems	shall provide information about the clock tick resolu‐
       tion by invoking sysconf(_SC_CLK_TCK).

RETURN VALUES
       There are two structures returned by the CPU statistics functions.

       typedef struct {
	       unsigned long long user;
	       unsigned long long kernel;
	       unsigned long long idle;
	       unsigned long long iowait;
	       unsigned long long swap;
	       unsigned long long nice;
	       unsigned long long total;

	       unsigned long long context_switches;
	       unsigned long long voluntary_context_switches;
	       unsigned long long involuntary_context_switches;
	       unsigned long long syscalls;
	       unsigned long long interrupts;
	       unsigned long long soft_interrupts;

	       time_t systime;
       } sg_cpu_stats;

       typedef struct {
	       double user;
	       double kernel;
	       double idle;
	       double iowait;
	       double swap;
	       double nice;
	       time_t time_taken;
       } sg_cpu_percents;

       user kernel idle iowait swap nice total
	      The different CPU states.

       context_switches voluntary_context_switches involuntary_context_switch‐
       es syscalls interrupts soft_interrupts
	      The different program actions on CPU.

       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			  2013-06-17		   sg_get_cpu_stats(3)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net