library: fixed miscellaneous whitespace/comment issues
. ensure whitespace exists between the code & comments [ changing txt slightly keeps right margin alignment ] . strive for more consistency with some comment styles [ don't use C '/*' style where C++ '//' style exists ] . removed the instance of double space in 1 assignment [ still striving for consistency in whitespace usage ] . fixed comment relating to number of 'derived fields' [ the <meminfo> api recently added one new such enum ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
89775d5418
commit
28f405689c
@ -99,13 +99,13 @@ struct fetch_support {
|
|||||||
struct diskstats_info {
|
struct diskstats_info {
|
||||||
int refcount;
|
int refcount;
|
||||||
FILE *diskstats_fp;
|
FILE *diskstats_fp;
|
||||||
time_t old_stamp; /* previous read seconds */
|
time_t old_stamp; // previous read seconds
|
||||||
time_t new_stamp; /* current read seconds */
|
time_t new_stamp; // current read seconds
|
||||||
struct dev_node *nodes; /* dev nodes anchor */
|
struct dev_node *nodes; // dev nodes anchor
|
||||||
struct ext_support select_ext; /* supports concurrent select/reap */
|
struct ext_support select_ext; // supports concurrent select/reap
|
||||||
struct ext_support fetch_ext; /* supports concurrent select/reap */
|
struct ext_support fetch_ext; // supports concurrent select/reap
|
||||||
struct fetch_support fetch; /* support for procps_diskstats_reap */
|
struct fetch_support fetch; // support for procps_diskstats_reap
|
||||||
struct diskstats_result get_this; /* used by procps_diskstats_get */
|
struct diskstats_result get_this; // used by procps_diskstats_get
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ static int meminfo_make_hash_failed (
|
|||||||
ENTRY e, *ep;
|
ENTRY e, *ep;
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
// will also include those 4 derived fields (more is better)
|
// will also include those derived fields (more is better)
|
||||||
n = sizeof(struct meminfo_data) / sizeof(unsigned long);
|
n = sizeof(struct meminfo_data) / sizeof(unsigned long);
|
||||||
// we'll follow the hsearch recommendation of an extra 25%
|
// we'll follow the hsearch recommendation of an extra 25%
|
||||||
hcreate_r(n + (n / 4), &info->hashtab);
|
hcreate_r(n + (n / 4), &info->hashtab);
|
||||||
@ -691,27 +691,27 @@ static struct stacks_extent *meminfo_stacks_alloc (
|
|||||||
if (maxstacks < 1)
|
if (maxstacks < 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vect_size = sizeof(void *) * maxstacks; // size of the addr vectors |
|
vect_size = sizeof(void *) * maxstacks; // size of the addr vectors |
|
||||||
vect_size += sizeof(void *); // plus NULL addr delimiter |
|
vect_size += sizeof(void *); // plus NULL addr delimiter |
|
||||||
head_size = sizeof(struct meminfo_stack); // size of that head struct |
|
head_size = sizeof(struct meminfo_stack); // size of that head struct |
|
||||||
list_size = sizeof(struct meminfo_result)*info->numitems; // any single results stack |
|
list_size = sizeof(struct meminfo_result)*info->numitems; // any single results stack |
|
||||||
blob_size = sizeof(struct stacks_extent); // the extent anchor itself |
|
blob_size = sizeof(struct stacks_extent); // the extent anchor itself |
|
||||||
blob_size += vect_size; // plus room for addr vects |
|
blob_size += vect_size; // plus room for addr vects |
|
||||||
blob_size += head_size * maxstacks; // plus room for head thing |
|
blob_size += head_size * maxstacks; // plus room for head thing |
|
||||||
blob_size += list_size * maxstacks; // plus room for our stacks |
|
blob_size += list_size * maxstacks; // plus room for our stacks |
|
||||||
|
|
||||||
/* note: all of our memory is allocated in a single blob, facilitating a later free(). |
|
/* note: all of this memory is allocated in a single blob, facilitating a later free(). |
|
||||||
as a minimum, it is important that the result structures themselves always be |
|
as a minimum, it is important that the result structures themselves always are |
|
||||||
contiguous for every stack since they are accessed through relative position. | */
|
contiguous within each stack since they're accessed through relative position. | */
|
||||||
if (NULL == (p_blob = calloc(1, blob_size)))
|
if (NULL == (p_blob = calloc(1, blob_size)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p_blob->next = info->extents; // push this extent onto... |
|
p_blob->next = info->extents; // push this extent onto... |
|
||||||
info->extents = p_blob; // ...some existing extents |
|
info->extents = p_blob; // ...some existing extents |
|
||||||
p_vect = (void *)p_blob + sizeof(struct stacks_extent); // prime our vector pointer |
|
p_vect = (void *)p_blob + sizeof(struct stacks_extent); // prime our vector pointer |
|
||||||
p_blob->stacks = p_vect; // set actual vectors start |
|
p_blob->stacks = p_vect; // set actual vectors start |
|
||||||
v_head = (void *)p_vect + vect_size; // prime head pointer start |
|
v_head = (void *)p_vect + vect_size; // prime head pointer start |
|
||||||
v_list = v_head + (head_size * maxstacks); // prime our stacks pointer |
|
v_list = v_head + (head_size * maxstacks); // prime our stacks pointer |
|
||||||
|
|
||||||
for (i = 0; i < maxstacks; i++) {
|
for (i = 0; i < maxstacks; i++) {
|
||||||
p_head = (struct meminfo_stack *)v_head;
|
p_head = (struct meminfo_stack *)v_head;
|
||||||
|
@ -510,7 +510,7 @@ static struct {
|
|||||||
|
|
||||||
/* please note,
|
/* please note,
|
||||||
* this enum MUST be 1 greater than the highest value of any enum */
|
* this enum MUST be 1 greater than the highest value of any enum */
|
||||||
enum pids_item PIDS_logical_end = PIDS_WCHAN_NAME + 1;
|
enum pids_item PIDS_logical_end = PIDS_WCHAN_NAME + 1;
|
||||||
|
|
||||||
#undef setNAME
|
#undef setNAME
|
||||||
#undef freNAME
|
#undef freNAME
|
||||||
|
114
proc/slabinfo.c
114
proc/slabinfo.c
@ -61,31 +61,31 @@
|
|||||||
|
|
||||||
|
|
||||||
struct slabs_summ {
|
struct slabs_summ {
|
||||||
unsigned int nr_objs; /* number of objects, among all caches */
|
unsigned int nr_objs; // number of objects, among all caches
|
||||||
unsigned int nr_active_objs; /* number of active objects, among all caches */
|
unsigned int nr_active_objs; // number of active objects, among all caches
|
||||||
unsigned int nr_pages; /* number of pages consumed by all objects */
|
unsigned int nr_pages; // number of pages consumed by all objects
|
||||||
unsigned int nr_slabs; /* number of slabs, among all caches */
|
unsigned int nr_slabs; // number of slabs, among all caches
|
||||||
unsigned int nr_active_slabs; /* number of active slabs, among all caches */
|
unsigned int nr_active_slabs; // number of active slabs, among all caches
|
||||||
unsigned int nr_caches; /* number of caches */
|
unsigned int nr_caches; // number of caches
|
||||||
unsigned int nr_active_caches; /* number of active caches */
|
unsigned int nr_active_caches; // number of active caches
|
||||||
unsigned int avg_obj_size; /* average object size */
|
unsigned int avg_obj_size; // average object size
|
||||||
unsigned int min_obj_size; /* size of smallest object */
|
unsigned int min_obj_size; // size of smallest object
|
||||||
unsigned int max_obj_size; /* size of largest object */
|
unsigned int max_obj_size; // size of largest object
|
||||||
unsigned long active_size; /* size of all active objects */
|
unsigned long active_size; // size of all active objects
|
||||||
unsigned long total_size; /* size of all objects */
|
unsigned long total_size; // size of all objects
|
||||||
};
|
};
|
||||||
|
|
||||||
struct slabs_node {
|
struct slabs_node {
|
||||||
char name[SLABINFO_NAME_LEN]; /* name of this cache */
|
char name[SLABINFO_NAME_LEN]; // name of this cache
|
||||||
unsigned long cache_size; /* size of entire cache */
|
unsigned long cache_size; // size of entire cache
|
||||||
unsigned int nr_objs; /* number of objects in this cache */
|
unsigned int nr_objs; // number of objects in this cache
|
||||||
unsigned int nr_active_objs; /* number of active objects */
|
unsigned int nr_active_objs; // number of active objects
|
||||||
unsigned int obj_size; /* size of each object */
|
unsigned int obj_size; // size of each object
|
||||||
unsigned int objs_per_slab; /* number of objects per slab */
|
unsigned int objs_per_slab; // number of objects per slab
|
||||||
unsigned int pages_per_slab; /* number of pages per slab */
|
unsigned int pages_per_slab; // number of pages per slab
|
||||||
unsigned int nr_slabs; /* number of slabs in this cache */
|
unsigned int nr_slabs; // number of slabs in this cache
|
||||||
unsigned int nr_active_slabs; /* number of active slabs */
|
unsigned int nr_active_slabs; // number of active slabs
|
||||||
unsigned int use; /* percent full: total / active */
|
unsigned int use; // percent full: total / active
|
||||||
};
|
};
|
||||||
|
|
||||||
struct slabs_hist {
|
struct slabs_hist {
|
||||||
@ -100,36 +100,36 @@ struct stacks_extent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ext_support {
|
struct ext_support {
|
||||||
int numitems; // includes 'logical_end' delimiter
|
int numitems; // includes 'logical_end' delimiter
|
||||||
enum slabinfo_item *items; // includes 'logical_end' delimiter
|
enum slabinfo_item *items; // includes 'logical_end' delimiter
|
||||||
struct stacks_extent *extents; // anchor for these extents
|
struct stacks_extent *extents; // anchor for these extents
|
||||||
#ifdef ENFORCE_LOGICAL
|
#ifdef ENFORCE_LOGICAL
|
||||||
enum slabinfo_item lowest; // range of allowable enums
|
enum slabinfo_item lowest; // range of allowable enums
|
||||||
enum slabinfo_item highest;
|
enum slabinfo_item highest;
|
||||||
#endif
|
#endif
|
||||||
int dirty_stacks;
|
int dirty_stacks;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fetch_support {
|
struct fetch_support {
|
||||||
struct slabinfo_stack **anchor; // fetch consolidated extents
|
struct slabinfo_stack **anchor; // fetch consolidated extents
|
||||||
int n_alloc; // number of above pointers allocated
|
int n_alloc; // number of above pointers allocated
|
||||||
int n_inuse; // number of above pointers occupied
|
int n_inuse; // number of above pointers occupied
|
||||||
int n_alloc_save; // last known reap.stacks allocation
|
int n_alloc_save; // last known reap.stacks allocation
|
||||||
struct slabinfo_reap results; // count + stacks for return to caller
|
struct slabinfo_reap results; // count + stacks for return to caller
|
||||||
};
|
};
|
||||||
|
|
||||||
struct slabinfo_info {
|
struct slabinfo_info {
|
||||||
int refcount;
|
int refcount;
|
||||||
FILE *slabinfo_fp;
|
FILE *slabinfo_fp;
|
||||||
int nodes_alloc; /* nodes alloc()ed */
|
int nodes_alloc; // nodes alloc()ed
|
||||||
int nodes_used; /* nodes using alloced memory */
|
int nodes_used; // nodes using alloced memory
|
||||||
struct slabs_node *nodes; /* first slabnode of this list */
|
struct slabs_node *nodes; // first slabnode of this list
|
||||||
struct slabs_hist slabs; /* new/old slabs_summ data */
|
struct slabs_hist slabs; // new/old slabs_summ data
|
||||||
struct ext_support select_ext; /* supports concurrent select/reap */
|
struct ext_support select_ext; // supports concurrent select/reap
|
||||||
struct ext_support fetch_ext; /* supports concurrent select/reap */
|
struct ext_support fetch_ext; // supports concurrent select/reap
|
||||||
struct fetch_support fetch; /* support for procps_slabinfo_reap */
|
struct fetch_support fetch; // support for procps_slabinfo_reap
|
||||||
struct slabs_node nul_node; /* used by slabinfo_get/select */
|
struct slabs_node nul_node; // used by slabinfo_get/select
|
||||||
struct slabinfo_result get_this; /* used by slabinfo_get */
|
struct slabinfo_result get_this; // used by slabinfo_get
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -657,27 +657,27 @@ static struct stacks_extent *slabinfo_stacks_alloc (
|
|||||||
if (maxstacks < 1)
|
if (maxstacks < 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vect_size = sizeof(void *) * maxstacks; // size of the addr vectors |
|
vect_size = sizeof(void *) * maxstacks; // size of the addr vectors |
|
||||||
vect_size += sizeof(void *); // plus NULL addr delimiter |
|
vect_size += sizeof(void *); // plus NULL addr delimiter |
|
||||||
head_size = sizeof(struct slabinfo_stack); // size of that head struct |
|
head_size = sizeof(struct slabinfo_stack); // size of that head struct |
|
||||||
list_size = sizeof(struct slabinfo_result)*this->numitems;// any single results stack |
|
list_size = sizeof(struct slabinfo_result)*this->numitems; // any single results stack |
|
||||||
blob_size = sizeof(struct stacks_extent); // the extent anchor itself |
|
blob_size = sizeof(struct stacks_extent); // the extent anchor itself |
|
||||||
blob_size += vect_size; // plus room for addr vects |
|
blob_size += vect_size; // plus room for addr vects |
|
||||||
blob_size += head_size * maxstacks; // plus room for head thing |
|
blob_size += head_size * maxstacks; // plus room for head thing |
|
||||||
blob_size += list_size * maxstacks; // plus room for our stacks |
|
blob_size += list_size * maxstacks; // plus room for our stacks |
|
||||||
|
|
||||||
/* note: all of our memory is allocated in a single blob, facilitating a later free(). |
|
/* note: all of our memory is allocated in one single blob, facilitating a later free(). |
|
||||||
as a minimum, it is important that the result structures themselves always be |
|
as a minimum, it is important that those result structures themselves always be |
|
||||||
contiguous for every stack since they are accessed through relative position. | */
|
contiguous within each stack since they are accessed through relative position. | */
|
||||||
if (NULL == (p_blob = calloc(1, blob_size)))
|
if (NULL == (p_blob = calloc(1, blob_size)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p_blob->next = this->extents; // push this extent onto... |
|
p_blob->next = this->extents; // push this extent onto... |
|
||||||
this->extents = p_blob; // ...some existing extents |
|
this->extents = p_blob; // ...some existing extents |
|
||||||
p_vect = (void *)p_blob + sizeof(struct stacks_extent); // prime our vector pointer |
|
p_vect = (void *)p_blob + sizeof(struct stacks_extent); // prime our vector pointer |
|
||||||
p_blob->stacks = p_vect; // set actual vectors start |
|
p_blob->stacks = p_vect; // set actual vectors start |
|
||||||
v_head = (void *)p_vect + vect_size; // prime head pointer start |
|
v_head = (void *)p_vect + vect_size; // prime head pointer start |
|
||||||
v_list = v_head + (head_size * maxstacks); // prime our stacks pointer |
|
v_list = v_head + (head_size * maxstacks); // prime our stacks pointer |
|
||||||
|
|
||||||
for (i = 0; i < maxstacks; i++) {
|
for (i = 0; i < maxstacks; i++) {
|
||||||
p_head = (struct slabinfo_stack *)v_head;
|
p_head = (struct slabinfo_stack *)v_head;
|
||||||
|
Loading…
Reference in New Issue
Block a user