]> granicus.if.org Git - procps-ng/commit
top: bust up that overly large 'summary_show' function
authorJim Warner <james.warner@comcast.net>
Thu, 13 Jan 2022 19:13:13 +0000 (13:13 -0600)
committerCraig Small <csmall@dropbear.xyz>
Mon, 17 Jan 2022 09:27:21 +0000 (20:27 +1100)
commit1f30c205d781b78bec4d5924ce59ba9cfeb24d89
tree94972f968dc36d4e1bf42d352b5d0a4252701a05
parent99ec6247ecca5179694d63be78dcc47bd90236aa
top: bust up that overly large 'summary_show' function

Over the years the summary_show function has increased
from around 77 lines of code & comments to its current
size of 195 lines. This is well beyond an ideal length
of available screen rows. So this patch will split it.

We'll take the cpu and memory duties and make separate
functions out of them. Of course, this will incur some
additional call overhead but, given current cpu/memory
logic, any such increase really becomes insignificant.

Now summary_show's a svelte 31 lines of code/comments.

[ this is like what was done to that do_key function ]
[ a decade ago except overhead of new function calls ]
[ plus table lookup was even less of a concern since ]
[ a human was involved, not normal iterative output. ]

Reference(s):
. 01/03/22, newlib branch equivalent commit
commit cbff1d;d10645cb8c7fc55dda08b06fbafed05932

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