lkml.org 
[lkml]   [2003]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [ANNOUNCE] slab information utility
From
Date
On Mon, 2003-09-22 at 00:43, Herbert Poetzl wrote:

> what about checking at which position the space occurs?
>
> at least to me it seems like pos < 20 would be okay
> for a space in the name 8-)

Not too pretty with the sscanf we do. Or even possible -- how do we
differentiate between n spaces and the next delimiter followed by a
legal field?
Anyhow, Chris and I concocted a little patch. Its not sexy but it
works. Apply it and recompile -- let me know.

Robert Love



proc/slab.c | 20 ++++++++------------
slabtop.c | 5 +++++
2 files changed, 13 insertions(+), 12 deletions(-)

diff -urN --exclude=CVS procps-cvs/proc/slab.c procps/proc/slab.c
--- procps-cvs/proc/slab.c 2003-09-21 23:01:59.816907168 -0400
+++ procps/proc/slab.c 2003-09-22 01:14:43.456249968 -0400
@@ -88,10 +88,8 @@
continue;

curr = get_slabnode();
- if (!curr) {
- curr = NULL;
+ if (!curr)
break;
- }

if (entries++ == 0)
*list = curr;
@@ -107,9 +105,9 @@
&curr->nr_slabs);

if (assigned < 8) {
- fprintf(stderr, "unrecognizable data in slabinfo!\n");
- curr = NULL;
- break;
+ curr->obj_size = 0;
+ prev = curr;
+ continue;
}

if (curr->obj_size < stats->min_obj_size)
@@ -168,10 +166,8 @@
int assigned;

curr = get_slabnode();
- if (!curr) {
- curr = NULL;
+ if (!curr)
break;
- }

if (entries++ == 0)
*list = curr;
@@ -186,9 +182,9 @@
&curr->pages_per_slab);

if (assigned < 6) {
- fprintf(stderr, "unrecognizable data in slabinfo!\n");
- curr = NULL;
- break;
+ curr->obj_size = 0;
+ prev = curr;
+ continue;
}

if (curr->obj_size < stats->min_obj_size)
diff -urN --exclude=CVS procps-cvs/slabtop.c procps/slabtop.c
--- procps-cvs/slabtop.c 2003-09-21 23:01:59.822906256 -0400
+++ procps/slabtop.c 2003-09-22 01:12:58.069271224 -0400
@@ -330,6 +330,11 @@

curr = slab_list;
for (i = 0; i < rows - 8 && curr->next; i++) {
+ if (!curr->obj_size) {
+ curr = curr->next;
+ i--;
+ continue;
+ }
printw("%6d %6d %3d%% %7.2fK %6d %8d %9dK %-23s\n",
curr->nr_objs, curr->nr_active_objs, curr->use,
curr->obj_size / 1024.0, curr->nr_slabs,
\
 
 \ /
  Last update: 2005-03-22 13:48    [from the cache]
©2003-2011 Jasper Spaans