3 |
|
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
4 |
|
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
5 |
|
|
6 |
< |
<refentry id="cpu_percent_usage"> |
6 |
> |
<refentry id="sg_get_cpu_stats"> |
7 |
|
|
8 |
|
<refentryinfo> |
9 |
|
<date>$Date$</date> |
10 |
|
<releaseinfo>$Id$</releaseinfo> |
11 |
|
</refentryinfo> |
12 |
< |
|
12 |
> |
|
13 |
|
<refmeta> |
14 |
< |
<refentrytitle>cpu_percent_usage</refentrytitle> |
14 |
> |
<refentrytitle>sg_get_cpu_stats</refentrytitle> |
15 |
|
<manvolnum>3</manvolnum> |
16 |
|
<refmiscinfo>i-scream</refmiscinfo> |
17 |
|
</refmeta> |
18 |
< |
|
18 |
> |
|
19 |
|
<refnamediv> |
20 |
< |
<refname>cpu_percent_usage</refname> |
21 |
< |
<refname>get_cpu_totals</refname> |
22 |
< |
<refname>get_cpu_diff</refname> |
20 |
> |
<refname>sg_get_cpu_stats</refname> |
21 |
> |
<refname>sg_get_cpu_stats_diff</refname> |
22 |
> |
<refname>sg_get_cpu_percents</refname> |
23 |
|
<refpurpose>get cpu usage</refpurpose> |
24 |
|
</refnamediv> |
25 |
< |
|
25 |
> |
|
26 |
|
<refsynopsisdiv> |
27 |
|
<funcsynopsis> |
28 |
|
<funcsynopsisinfo>#include <statgrab.h></funcsynopsisinfo> |
29 |
|
<funcprototype> |
30 |
< |
<funcdef>cpu_percent_t *<function>cpu_percent_usage</function></funcdef> |
30 |
> |
<funcdef>sg_cpu_percents *<function>sg_get_cpu_percents</function></funcdef> |
31 |
|
<void/> |
32 |
|
</funcprototype> |
33 |
|
<funcprototype> |
34 |
< |
<funcdef>cpu_states_t *<function>get_cpu_totals</function></funcdef> |
34 |
> |
<funcdef>sg_cpu_stats *<function>sg_get_cpu_stats</function></funcdef> |
35 |
|
<void/> |
36 |
|
</funcprototype> |
37 |
|
<funcprototype> |
38 |
< |
<funcdef>cpu_states_t *<function>get_cpu_diff</function></funcdef> |
38 |
> |
<funcdef>sg_cpu_stats *<function>sg_get_cpu_stats_diff</function></funcdef> |
39 |
|
<void/> |
40 |
|
</funcprototype> |
41 |
|
</funcsynopsis> |
42 |
|
</refsynopsisdiv> |
43 |
< |
|
43 |
> |
|
44 |
|
<refsect1> |
45 |
|
<title>Description</title> |
46 |
|
<para> |
47 |
< |
<function>get_cpu_totals()</function> and |
48 |
< |
<function>get_cpu_diff()</function> both return static pointers |
49 |
< |
of type <structname>cpu_states_t</structname>. |
50 |
< |
<function>get_cpu_totals()</function> returns the total amount of |
47 |
> |
<function>sg_get_cpu_stats()</function> and |
48 |
> |
<function>sg_get_cpu_stats_diff()</function> both return static pointers |
49 |
> |
of type <structname>sg_cpu_stats</structname>. |
50 |
> |
<function>sg_get_cpu_stats()</function> returns the total amount of |
51 |
|
"ticks" the operating system has spent in each of the different |
52 |
< |
states. <function>get_cpu_diff()</function> returns the |
52 |
> |
states. <function>sg_get_cpu_stats_diff()</function> returns the |
53 |
|
difference in "ticks" for each of the states since last time |
54 |
< |
<function>get_cpu_diff()</function> or |
55 |
< |
<function>get_cpu_totals()</function> was called. If it has never |
54 |
> |
<function>sg_get_cpu_stats_diff()</function> or |
55 |
> |
<function>sg_get_cpu_stats()</function> was called. If it has never |
56 |
|
been called, it will return the result of |
57 |
< |
<function>get_cpu_totals()</function>. |
57 |
> |
<function>sg_get_cpu_stats()</function>. |
58 |
|
</para> |
59 |
|
<para> |
60 |
|
The value stored (the "ticks") will vary between operating |
68 |
|
against the total, or in percentages. |
69 |
|
</para> |
70 |
|
<para> |
71 |
< |
<function>cpu_percent_usage()</function> returns a pointer to a |
72 |
< |
static <structname>cpu_percent_t</structname>. The function |
73 |
< |
calls <function>get_cpu_diff()</function> and changes the values |
71 |
> |
<function>sg_get_cpu_percents()</function> returns a pointer to a |
72 |
> |
static <structname>sg_cpu_percents</structname>. The function |
73 |
> |
calls <function>sg_get_cpu_stats_diff()</function> and changes the values |
74 |
|
into percentages. If it has never been called before (and nor has |
75 |
< |
<function>get_cpu_totals()</function> or |
76 |
< |
<function>get_cpu_diff()</function>), the returned percentages |
75 |
> |
<function>sg_get_cpu_stats()</function> or |
76 |
> |
<function>sg_get_cpu_stats_diff()</function>), the returned percentages |
77 |
|
will be the systems total ever since its uptime. (Unless the |
78 |
|
counters have cycled) |
79 |
|
</para> |
80 |
|
</refsect1> |
81 |
< |
|
81 |
> |
|
82 |
|
<refsect1> |
83 |
|
<title>Return Values</title> |
84 |
|
|
97 |
|
long long nice; |
98 |
|
long long total; |
99 |
|
time_t systime; |
100 |
< |
}cpu_states_t; |
100 |
> |
}sg_cpu_stats; |
101 |
|
</programlisting> |
102 |
|
|
103 |
|
<programlisting> |
109 |
|
float swap; |
110 |
|
float nice; |
111 |
|
time_t time_taken; |
112 |
< |
}cpu_percent_t; |
112 |
> |
}sg_cpu_percents; |
113 |
|
</programlisting> |
114 |
|
|
115 |
|
<variablelist> |
145 |
|
|
146 |
|
<refsect1> |
147 |
|
<title>See Also</title> |
148 |
< |
<para>Nothing yet</para> |
148 |
> |
|
149 |
> |
<simplelist type="inline"> |
150 |
> |
<member> |
151 |
> |
<citerefentry> |
152 |
> |
<refentrytitle>statgrab</refentrytitle> |
153 |
> |
<manvolnum>3</manvolnum> |
154 |
> |
</citerefentry> |
155 |
> |
</member> |
156 |
> |
</simplelist> |
157 |
|
</refsect1> |
158 |
< |
|
158 |
> |
|
159 |
|
<refsect1> |
160 |
|
<title>Website</title> |
161 |
< |
|
161 |
> |
|
162 |
|
<simplelist type="vert"> |
163 |
|
<member> |
164 |
< |
<ulink url="http://www.i-scream.org">http://www.i-scream.org</ulink> |
164 |
> |
<ulink url="http://www.i-scream.org/libstatgrab/"> |
165 |
> |
http://www.i-scream.org/libstatgrab/ |
166 |
> |
</ulink> |
167 |
|
</member> |
168 |
|
</simplelist> |
169 |
|
</refsect1> |