top: restore the former behavior after stderr redirect
When top originally responded to the potential libnuma stderr write, the library was consistently called with each refresh cycle. That, in turn, guaranteed that any warning message would be seen at program end by virtue of: 1) having been issued before the 2nd refresh cycle and; 2) benefiting from inherited /dev/null buffering. A later efficiency refactor meant the numa library may not always be called with every refresh cycle. Rather, it was only called if top was in one of two numa views (the '2' or '3' toggles). That, in turn, resulted in a loss of any warning message at program end unless numa mode had been preserved in the rcfile. In other words, if top was started normally then a single cycle stderr redirect would have long passed by the time the '2' or '3' toggle was activated. The warning message actually was spewed but quickly lost to the full screen refresh which follows all keyboard interactions with the user. This commit simply moves the restoration of our stderr redirect to program end (instead of that first display refresh). Now, any libnuma stderr warning message will appear as the concluding output line upon quitting top without regard to when any numa mode view was invoked. And since this technique might be useful in some other context (as an example of how to 'buffer' stderr) it's been generalized with its own #define. But to maximize its usefulness, the original redirect should be issued much earlier in pgm startup than top has chosen to do. Reference(s): . original libnuma stderr response (msg seen) commit35dc6dcc49. numa refractoring for efficiency (msg lost) commitf12c0d5c6eSigned-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
//#define OFF_HST_HASH /* use BOTH qsort+bsrch vs. hashing scheme */
|
||||
//#define OFF_NUMASKIP /* do NOT skip numa nodes if discontinuous */
|
||||
//#define OFF_SCROLLBK /* disable tty emulators scrollback buffer */
|
||||
//#define OFF_STDERROR /* disable our stderr buffering (redirect) */
|
||||
//#define OFF_STDIOLBF /* disable our own stdout _IOFBF override */
|
||||
//#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */
|
||||
//#define PRETEND8CPUS /* pretend we're smp with 8 ticsers (sic) */
|
||||
|
||||
Reference in New Issue
Block a user