ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/docs/sg_get_process_stats.xml
(Generate patch)

Comparing projects/libstatgrab/docs/sg_get_process_stats.xml (file contents):
Revision 1.6 by tdb, Sun May 2 17:39:19 2004 UTC vs.
Revision 1.7 by tdb, Tue May 4 19:28:06 2004 UTC

# Line 3 | Line 3
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="sg_get_process_count">
6 > <refentry id="sg_get_process_stats">
7  
8    <refentryinfo>
9      <date>$Date$</date>
# Line 11 | Line 11
11    </refentryinfo>
12  
13    <refmeta>
14 <    <refentrytitle>sg_get_process_count</refentrytitle>
14 >    <refentrytitle>sg_get_process_stats</refentrytitle>
15      <manvolnum>3</manvolnum>
16      <refmiscinfo>i-scream</refmiscinfo>
17    </refmeta>
18  
19    <refnamediv>
20 +    <refname>sg_get_process_stats</refname>
21      <refname>sg_get_process_count</refname>
22      <refpurpose>get process statistics</refpurpose>
23    </refnamediv>
# Line 25 | Line 26
26      <funcsynopsis>
27        <funcsynopsisinfo>#include &lt;statgrab.h&gt;</funcsynopsisinfo>
28        <funcprototype>
29 +        <funcdef>sg_process_stats *<function>sg_get_process_stats</function></funcdef>
30 +        <paramdef>int *<parameter>entries</parameter></paramdef>
31 +      </funcprototype>
32 +      <funcprototype>
33          <funcdef>sg_process_count *<function>sg_get_process_count</function></funcdef>
34          <void/>
35        </funcprototype>
# Line 34 | Line 39
39    <refsect1>
40      <title>Description</title>
41      <para>
42 +      The <function>sg_get_process_stats</function> takes a pointer to
43 +      an int, <parameter>entries</parameter>, which is filled with the
44 +      number of processes the snapshot contains. A pointer to the first
45 +      entry, of type <structname>sg_process_stats</structname> is
46 +      returned, and <parameter>entries</parameter> can be used to iterate
47 +      through to the last entry.
48 +    </para>
49 +    <para>
50        <function>sg_get_process_count</function> returns a pointer to a
51        static buffer of type <structname>sg_process_count</structname>.
52      </para>
53      <para>
54 <      It provides information on the number of processes and the
55 <      system and the different states they're in.
54 >      These two functions provide information on the process running
55 >      on the system. In the first case lots of detail is provided, and
56 >      in the second case a summary of the states of the current processes.
57      </para>
58    </refsect1>
59  
# Line 47 | Line 61
61      <title>Return Values</title>
62  
63      <para>
64 <      The structure returned is of type
64 >      The structure returned by sg_get_process_stats is of type
65 >      <structname>sg_process_stats</structname>.
66 >    </para>
67 >
68 >    <programlisting>
69 > typedef struct {
70 >        char *process_name;
71 >        char *proctitle;
72 >
73 >        pid_t pid;
74 >        pid_t parent; /* Parent pid */
75 >        pid_t pgid;   /* process id of process group leader */
76 >
77 >        uid_t uid;
78 >        uid_t euid;
79 >        gid_t gid;
80 >        gid_t egid;
81 >
82 >        unsigned long long proc_size; /* in bytes */
83 >        unsigned long long proc_resident; /* in bytes */
84 >        time_t time_spent; /* time running in seconds */
85 >        double cpu_percent;
86 >        int nice;
87 >        sg_process_state state;
88 > } sg_process_stats;
89 >    </programlisting>
90 >
91 >    <programlisting>
92 > typedef enum {
93 >        SG_PROCESS_STATE_RUNNING,
94 >        SG_PROCESS_STATE_SLEEPING,
95 >        SG_PROCESS_STATE_STOPPED,
96 >        SG_PROCESS_STATE_ZOMBIE,
97 >        SG_PROCESS_STATE_UNKNOWN
98 > } sg_process_state;
99 >    </programlisting>
100 >
101 >    <variablelist>
102 >      <varlistentry>
103 >        <term><structfield>process_name</structfield></term>
104 >        <listitem>
105 >          <para>
106 >            The name of the command that was run.
107 >          </para>
108 >        </listitem>
109 >      </varlistentry>
110 >      <varlistentry>
111 >        <term><structfield>proctitle</structfield></term>
112 >        <listitem>
113 >          <para>
114 >            The command line (the "title") of the process. Take
115 >            note - this can be modified by the process, so isn't
116 >            guaranteed to be the original command line.
117 >          </para>
118 >        </listitem>
119 >      </varlistentry>
120 >      <varlistentry>
121 >        <term><structfield>pid</structfield></term>
122 >        <listitem>
123 >          <para>
124 >            The process ID.
125 >          </para>
126 >        </listitem>
127 >      </varlistentry>
128 >      <varlistentry>
129 >        <term><structfield>parent</structfield></term>
130 >        <listitem>
131 >          <para>
132 >            The parent process ID.
133 >          </para>
134 >        </listitem>
135 >      </varlistentry>
136 >      <varlistentry>
137 >        <term><structfield>pgid</structfield></term>
138 >        <listitem>
139 >          <para>
140 >            The process ID of the process group leader.
141 >          </para>
142 >        </listitem>
143 >      </varlistentry>
144 >      <varlistentry>
145 >        <term><structfield>uid</structfield></term>
146 >        <listitem>
147 >          <para>
148 >            The UID the process is running as.
149 >          </para>
150 >        </listitem>
151 >      </varlistentry>
152 >      <varlistentry>
153 >        <term><structfield>euid</structfield></term>
154 >        <listitem>
155 >          <para>
156 >            The effective UID the process is running as.
157 >          </para>
158 >        </listitem>
159 >      </varlistentry>
160 >      <varlistentry>
161 >        <term><structfield>gid</structfield></term>
162 >        <listitem>
163 >          <para>
164 >            The GID the process is running as.
165 >          </para>
166 >        </listitem>
167 >      </varlistentry>
168 >      <varlistentry>
169 >        <term><structfield>egid</structfield></term>
170 >        <listitem>
171 >          <para>
172 >            The effective GID the process is running as.
173 >          </para>
174 >        </listitem>
175 >      </varlistentry>
176 >      <varlistentry>
177 >        <term><structfield>proc_size</structfield></term>
178 >        <listitem>
179 >          <para>
180 >            The size of the process in bytes.
181 >          </para>
182 >        </listitem>
183 >      </varlistentry>
184 >      <varlistentry>
185 >        <term><structfield>proc_resident</structfield></term>
186 >        <listitem>
187 >          <para>
188 >            The size of the process that's resident in memory.
189 >          </para>
190 >        </listitem>
191 >      </varlistentry>
192 >      <varlistentry>
193 >        <term><structfield>time_spent</structfield></term>
194 >        <listitem>
195 >          <para>
196 >            The number of seconds the process has been running.
197 >          </para>
198 >        </listitem>
199 >      </varlistentry>
200 >      <varlistentry>
201 >        <term><structfield>cpu_percent</structfield></term>
202 >        <listitem>
203 >          <para>
204 >            The current percentage of CPU the process is using.
205 >          </para>
206 >        </listitem>
207 >      </varlistentry>
208 >      <varlistentry>
209 >        <term><structfield>nice</structfield></term>
210 >        <listitem>
211 >          <para>
212 >            The nice value of the process.
213 >          </para>
214 >        </listitem>
215 >      </varlistentry>
216 >      <varlistentry>
217 >        <term><structfield>state</structfield></term>
218 >        <listitem>
219 >          <para>
220 >            The current state of the process. See sg_process_state
221 >            for permitted values.
222 >          </para>
223 >        </listitem>
224 >      </varlistentry>
225 >    </variablelist>
226 >
227 >    <para>
228 >      The structure returned by sg_get_process_count is of type
229        <structname>sg_process_count</structname>.
230      </para>
231  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines