| 19 |
|
<refnamediv> |
| 20 |
|
<refname>sg_get_process_stats</refname> |
| 21 |
|
<refname>sg_get_process_count</refname> |
| 22 |
+ |
<refname>sg_process_compare_name</refname> |
| 23 |
+ |
<refname>sg_process_compare_pid</refname> |
| 24 |
+ |
<refname>sg_process_compare_uid</refname> |
| 25 |
+ |
<refname>sg_process_compare_gid</refname> |
| 26 |
+ |
<refname>sg_process_compare_size</refname> |
| 27 |
+ |
<refname>sg_process_compare_res</refname> |
| 28 |
+ |
<refname>sg_process_compare_cpu</refname> |
| 29 |
+ |
<refname>sg_process_compare_time</refname> |
| 30 |
|
<refpurpose>get process statistics</refpurpose> |
| 31 |
|
</refnamediv> |
| 32 |
|
|
| 41 |
|
<funcdef>sg_process_count *<function>sg_get_process_count</function></funcdef> |
| 42 |
|
<void/> |
| 43 |
|
</funcprototype> |
| 44 |
+ |
|
| 45 |
+ |
<funcprototype> |
| 46 |
+ |
<funcdef>int <function>sg_process_compare_name</function></funcdef> |
| 47 |
+ |
<paramdef>const void *<parameter>va</parameter></paramdef> |
| 48 |
+ |
<paramdef>const void *<parameter>vb</parameter></paramdef> |
| 49 |
+ |
</funcprototype> |
| 50 |
+ |
<funcprototype> |
| 51 |
+ |
<funcdef>int <function>sg_process_compare_pid</function></funcdef> |
| 52 |
+ |
<paramdef>const void *<parameter>va</parameter></paramdef> |
| 53 |
+ |
<paramdef>const void *<parameter>vb</parameter></paramdef> |
| 54 |
+ |
</funcprototype> |
| 55 |
+ |
<funcprototype> |
| 56 |
+ |
<funcdef>int <function>sg_process_compare_uid</function></funcdef> |
| 57 |
+ |
<paramdef>const void *<parameter>va</parameter></paramdef> |
| 58 |
+ |
<paramdef>const void *<parameter>vb</parameter></paramdef> |
| 59 |
+ |
</funcprototype> |
| 60 |
+ |
<funcprototype> |
| 61 |
+ |
<funcdef>int <function>sg_process_compare_gid</function></funcdef> |
| 62 |
+ |
<paramdef>const void *<parameter>va</parameter></paramdef> |
| 63 |
+ |
<paramdef>const void *<parameter>vb</parameter></paramdef> |
| 64 |
+ |
</funcprototype> |
| 65 |
+ |
<funcprototype> |
| 66 |
+ |
<funcdef>int <function>sg_process_compare_size</function></funcdef> |
| 67 |
+ |
<paramdef>const void *<parameter>va</parameter></paramdef> |
| 68 |
+ |
<paramdef>const void *<parameter>vb</parameter></paramdef> |
| 69 |
+ |
</funcprototype> |
| 70 |
+ |
<funcprototype> |
| 71 |
+ |
<funcdef>int <function>sg_process_compare_res</function></funcdef> |
| 72 |
+ |
<paramdef>const void *<parameter>va</parameter></paramdef> |
| 73 |
+ |
<paramdef>const void *<parameter>vb</parameter></paramdef> |
| 74 |
+ |
</funcprototype> |
| 75 |
+ |
<funcprototype> |
| 76 |
+ |
<funcdef>int <function>sg_process_compare_cpu</function></funcdef> |
| 77 |
+ |
<paramdef>const void *<parameter>va</parameter></paramdef> |
| 78 |
+ |
<paramdef>const void *<parameter>vb</parameter></paramdef> |
| 79 |
+ |
</funcprototype> |
| 80 |
+ |
<funcprototype> |
| 81 |
+ |
<funcdef>int <function>sg_process_compare_time</function></funcdef> |
| 82 |
+ |
<paramdef>const void *<parameter>va</parameter></paramdef> |
| 83 |
+ |
<paramdef>const void *<parameter>vb</parameter></paramdef> |
| 84 |
+ |
</funcprototype> |
| 85 |
+ |
|
| 86 |
|
</funcsynopsis> |
| 87 |
|
</refsynopsisdiv> |
| 88 |
|
|
| 91 |
|
<para> |
| 92 |
|
The <function>sg_get_process_stats</function> takes a pointer to |
| 93 |
|
an int, <parameter>entries</parameter>, which is filled with the |
| 94 |
< |
number of processes the snapshot contains. A pointer to the first |
| 95 |
< |
entry, of type <structname>sg_process_stats</structname> is |
| 96 |
< |
returned, and <parameter>entries</parameter> can be used to iterate |
| 97 |
< |
through to the last entry. |
| 94 |
> |
number of processes the snapshot contains. The return value is a |
| 95 |
> |
pointer to the first member of an array of |
| 96 |
> |
<structname>sg_process_stats</structname> structures; the number |
| 97 |
> |
of entries in the array is returned in |
| 98 |
> |
<parameter>entries</parameter>. |
| 99 |
|
</para> |
| 100 |
|
<para> |
| 101 |
|
<function>sg_get_process_count</function> returns a pointer to a |
| 106 |
|
on the system. In the first case lots of detail is provided, and |
| 107 |
|
in the second case a summary of the states of the current processes. |
| 108 |
|
</para> |
| 109 |
+ |
<para> |
| 110 |
+ |
<simplelist type="vert"> |
| 111 |
+ |
<member><function>sg_process_compare_name</function></member> |
| 112 |
+ |
<member><function>sg_process_compare_pid</function></member> |
| 113 |
+ |
<member><function>sg_process_compare_uid</function></member> |
| 114 |
+ |
<member><function>sg_process_compare_gid</function></member> |
| 115 |
+ |
<member><function>sg_process_compare_size</function></member> |
| 116 |
+ |
<member><function>sg_process_compare_res</function></member> |
| 117 |
+ |
<member><function>sg_process_compare_cpu</function></member> |
| 118 |
+ |
<member><function>sg_process_compare_time</function></member> |
| 119 |
+ |
</simplelist> |
| 120 |
+ |
</para> |
| 121 |
+ |
<para> |
| 122 |
+ |
These functions compare two sg_process_stats entries, and return an |
| 123 |
+ |
int to represent which one is greater. The main use of these functions |
| 124 |
+ |
is to be passed to qsort to sort the sg_process_stats by the given type. |
| 125 |
+ |
</para> |
| 126 |
+ |
<para> |
| 127 |
+ |
For example: |
| 128 |
+ |
</para> |
| 129 |
+ |
<para> |
| 130 |
+ |
<function>qsort</function>(<structname>sg_process_stats</structname> ps, int ps_size, sizeof *ps, sg_process_compare_pid); |
| 131 |
+ |
</para> |
| 132 |
+ |
|
| 133 |
|
</refsect1> |
| 134 |
|
|
| 135 |
|
<refsect1> |