--- projects/libstatgrab/docs/sg_get_process_stats.xml 2004/05/04 19:28:06 1.7 +++ projects/libstatgrab/docs/sg_get_process_stats.xml 2004/05/18 14:33:11 1.9 @@ -6,8 +6,8 @@ - $Date: 2004/05/04 19:28:06 $ - $Id: sg_get_process_stats.xml,v 1.7 2004/05/04 19:28:06 tdb Exp $ + $Date: 2004/05/18 14:33:11 $ + $Id: sg_get_process_stats.xml,v 1.9 2004/05/18 14:33:11 pajs Exp $ @@ -19,6 +19,14 @@ sg_get_process_stats sg_get_process_count + sg_process_compare_name + sg_process_compare_pid + sg_process_compare_uid + sg_process_compare_gid + sg_process_compare_size + sg_process_compare_res + sg_process_compare_cpu + sg_process_compare_time get process statistics @@ -33,6 +41,48 @@ sg_process_count *sg_get_process_count + + + int sg_process_compare_name + const void *va + const void *vb + + + int sg_process_compare_pid + const void *va + const void *vb + + + int sg_process_compare_uid + const void *va + const void *vb + + + int sg_process_compare_gid + const void *va + const void *vb + + + int sg_process_compare_size + const void *va + const void *vb + + + int sg_process_compare_res + const void *va + const void *vb + + + int sg_process_compare_cpu + const void *va + const void *vb + + + int sg_process_compare_time + const void *va + const void *vb + + @@ -41,10 +91,11 @@ The sg_get_process_stats takes a pointer to an int, entries, which is filled with the - number of processes the snapshot contains. A pointer to the first - entry, of type sg_process_stats is - returned, and entries can be used to iterate - through to the last entry. + number of processes the snapshot contains. The return value is a + pointer to the first member of an array of + sg_process_stats structures; the number + of entries in the array is returned in + entries. sg_get_process_count returns a pointer to a @@ -55,6 +106,30 @@ on the system. In the first case lots of detail is provided, and in the second case a summary of the states of the current processes. + + + sg_process_compare_name + sg_process_compare_pid + sg_process_compare_uid + sg_process_compare_gid + sg_process_compare_size + sg_process_compare_res + sg_process_compare_cpu + sg_process_compare_time + + + + These functions compare two sg_process_stats entries, and return an + int to represent which one is greater. The main use of these functions + is to be passed to qsort to sort the sg_process_stats by the given type. + + + For example: + + + qsort(sg_process_stats ps, int ps_size, sizeof *ps, sg_process_compare_pid); + +