library: add final remaining sort function, <STAT> api
With this patch, all of the modules which offer a reap function (pids, diskstats, slabinfo and stat too) will now also provide for sorting whatever had been reaped. It was easy to overlook a sort function for our <STAT> guy given the paucity of CPUs on your typical personal desktop or laptop. However, out in the world one might find boxes with hundreds of CPUs plus many NUMA nodes. Hey, who are we to disallow sorts on something another person might see as useful under the above conditions? And, there's always something to be said for symmetry. [ of course, several minor tweaks were also included ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
13
proc/stat.h
13
proc/stat.h
@@ -70,6 +70,12 @@ enum stat_reap_type {
|
||||
STAT_REAP_CPUS_AND_NODES
|
||||
};
|
||||
|
||||
enum stat_sort_order {
|
||||
STAT_SORT_ASCEND = +1,
|
||||
STAT_SORT_DESCEND = -1
|
||||
};
|
||||
|
||||
|
||||
struct stat_result {
|
||||
enum stat_item item;
|
||||
union {
|
||||
@@ -127,6 +133,13 @@ struct stat_stack *procps_stat_select (
|
||||
enum stat_item *items,
|
||||
int numitems);
|
||||
|
||||
struct stat_stack **procps_stat_sort (
|
||||
struct stat_info *info,
|
||||
struct stat_stack *stacks[],
|
||||
int numstacked,
|
||||
enum stat_item sortitem,
|
||||
enum stat_sort_order order);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user