]> granicus.if.org Git - procps-ng/commit
top: eliminate all of that 'relative enumerator' bloat
authorJim Warner <james.warner@comcast.net>
Wed, 1 Aug 2018 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Mon, 13 Aug 2018 10:54:48 +0000 (20:54 +1000)
commit65feb3c558646f72375f4950d5c8b92ad01525af
tree66c0a9ffb4e36606f6345f1facaf554786307c74
parent76a2d4c0a1cb1a71951b1fbd5a105fdf8adc4857
top: eliminate all of that 'relative enumerator' bloat

The top program has always specified the maximum stack
depth at 'new' time. Then, in those stacks the minimum
number of result structures were used for representing
only fields actually being displayed in the 4 windows.

That, however, complicated all subsequent access since
each field's enumerator then had to be translated into
a relative position when interacting with the library.
This was accomplished by that Fieldstab 'erel' member.

So this patch eliminates an extra level of indirection
by fully exploiting the existing maximum sized stacks.
Now, the enumerators that top uses to represent fields
also represent their relative positions in each stack.

[ for fields not actually displayed, the position in ]
[ a stack is represented by the 'PIDS_extra' struct. ]
[ thus, there isn't any real library costs for those ]
[ enumerators/fields which aren't currently visible. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c