top: when setting library flags favor stat over status

Long ago, in a galaxy far away, top was convinced that
/proc/stat was to be favored over /proc/status if some
field could be satisfied with either. This was done to
avoid extra costs of 64-bit math for 32-bit platforms.

Well, its time to acknowledge the prevalence of 64-bit
platforms. And in such an environment there is a large
hidden cost currently if using status instead of stat.
In fact, that cost difference can be as high as 1400%.

So, this commit will coax top into favoring that least
costly route while also fixing an EU_TGD library flag.

[ this patch parallels similar changes to newlib top ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-08-20 00:00:00 -05:00 committed by Craig Small
parent 67a634dc4c
commit 7df87ea7cf

View File

@ -1772,7 +1772,7 @@ static FLD_t Fieldstab[] = {
{ -1, -1, A_left, SF(CGR), L_CGROUP }, { -1, -1, A_left, SF(CGR), L_CGROUP },
{ -1, -1, A_left, SF(SGD), L_status }, { -1, -1, A_left, SF(SGD), L_status },
{ -1, -1, A_left, SF(SGN), L_SUPGRP }, { -1, -1, A_left, SF(SGN), L_SUPGRP },
{ 0, -1, A_right, SF(TGD), L_status }, { 0, -1, A_right, SF(TGD), L_NONE },
{ 5, -1, A_right, SF(OOA), L_OOM }, { 5, -1, A_right, SF(OOA), L_OOM },
{ 4, -1, A_right, SF(OOM), L_OOM }, { 4, -1, A_right, SF(OOM), L_OOM },
{ -1, -1, A_left, SF(ENV), L_ENVIRON }, { -1, -1, A_left, SF(ENV), L_ENVIRON },
@ -1965,8 +1965,10 @@ static void build_headers (void) {
#endif #endif
// finalize/touchup the libproc PROC_FILLxxx flags for current config... // finalize/touchup the libproc PROC_FILLxxx flags for current config...
if ((Frames_libflags & L_EITHER) && !(Frames_libflags & L_stat)) if (Frames_libflags & L_EITHER) {
Frames_libflags |= L_status; if (!(Frames_libflags & (L_stat | L_status)))
Frames_libflags |= L_stat;
}
if (!Frames_libflags) Frames_libflags = L_DEFAULT; if (!Frames_libflags) Frames_libflags = L_DEFAULT;
if (Monpidsidx) Frames_libflags |= PROC_PID; if (Monpidsidx) Frames_libflags |= PROC_PID;
} // end: build_headers } // end: build_headers