]> granicus.if.org Git - procps-ng/commit
top: avoid yet more overhead of accessing /proc/status
authorJim Warner <james.warner@comcast.net>
Sun, 21 Aug 2016 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Tue, 23 Aug 2016 11:11:09 +0000 (21:11 +1000)
commitb53fb7f8ea19bac8e3d2cc4b32e6ba46fc57a2e9
tree90f3dff653dcb271773b4b25e426d08cebd3a4db
parent3ac040d047df189f61f7c1c3341b987aa400f674
top: avoid yet more overhead of accessing /proc/status

After discovering those terrible costs associated with
/proc/status vs. /proc/stat, our library changed so as
to favor the latter if a field could be met by either.

Well, low-and-behold, this top program had chosen some
item enumerators that needlessly caused 'status' to be
accessed when 'statm' could be used instead. And while
top's needs require conversion from pages to KiB, that
is still far less costly than that damn 'status' file.

[ this was found when comparing newlib top against a ]
[ 3.2.8 ancient top since the current master top was ]
[ suffering from the exact same 'status' deficiency. ]

[ and, no way was top-3.2.8 going to beat newlib top ]
[ by 50% - we'll allow only a 1-10% occasional loss! ]

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