library: miscellaneous tweaks to pid code and comments

. traded a complex misaligned memory allocation scheme
in the make_hist function for a simple aligned scheme.
plus memory allocation increases are globally defined.

. changed 1 parameter for procps_pids_stacks_sort() to
better reflect the 'array of pointers', not an address
of a pointer as is used with guys such as 'new/unref'.

. the pids_reap struct was changed slightly to make it
more reflective of it's actual implementation details.

. the Item_table member .mustfree is now .needfree and
that .makehist was now made .needhist for consistency.

. reduced the number of separate 'return NULL;' source
statements in that primary procps_pids_reap() routine.

. ensured consistent reference to sizeof(void *) & not
occasional reference to sizeof(void*) without a space.

. rather than enable/disable validate_stacks via a #if
in the function body, it is now handled via a #define.

. some comments in the procps_pids_reset function were
adjusted to reflect this current implementation. shown
originally, they reflected an aborted attempt to avoid
a testing aberration not fully understood at the time.

. added a summary of the memory overhead cost of HST_t
processing to that UNREF_RPTHASH output at unref time.

. a 'PIDs at max depth:' portion of that UNREF_RPTHASH
enabled #define is now published only when the maximum
depth of hash table entry chains exceed depths of one.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2015-08-20 00:00:00 -05:00
committed by Craig Small
parent f937ff8238
commit 387d4030f4
2 changed files with 69 additions and 65 deletions

View File

@ -181,7 +181,7 @@ struct pids_counts {
};
struct pids_reap {
struct pids_stacks reaped;
struct pids_stack **stacks;
struct pids_counts counts;
};
@ -219,7 +219,7 @@ struct pids_counts *procps_pids_stacks_fill (
struct pids_stack **procps_pids_stacks_sort (
struct procps_pidsinfo *info,
struct pids_stack **stacks,
struct pids_stack *stacks[],
int numstacked,
enum pids_item sort,
enum pids_sort_order order);