From a2086dfdf698f93de431349cf9a990fc5b95a768 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Wed, 4 Jul 2012 04:04:04 -0500 Subject: [PATCH] top: revise default for forest view child scans In an effort to avoid dangling children when in forest view mode, top defaulted to a complete rescan of every proc_t for each child encountered. That expense was never really cost justified and now with the 3.3 kernel 'hidepid' provisions it no longer can offer such protection. With this commit, the TREE_ONEPASS define is changed to TREE_RESCANS so as to reverse the default scan behavior. Signed-off-by: Jim Warner --- top/top.c | 8 ++++---- top/top.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/top/top.c b/top/top.c index 572ade63..bfe57276 100644 --- a/top/top.c +++ b/top/top.c @@ -3392,11 +3392,11 @@ static void forest_add (const int self, const int level) { Tree_ppt[Tree_idx] = Seed_ppt[self]; // add this as root or child Tree_ppt[Tree_idx++]->pad_3 = level; // borrow 1 byte, 127 levels -#ifdef TREE_ONEPASS - for (i = self + 1; i < Frame_maxtask; i++) { +#ifdef TREE_RESCANS + for (i = 0; i < Frame_maxtask; i++) { // this is hardly bullet proof now, + if (i == self) continue; // with 3.3 proc hidepid provisions #else - for (i = 0; i < Frame_maxtask; i++) { - if (i == self) continue; + for (i = self + 1; i < Frame_maxtask; i++) { #endif if (Seed_ppt[self]->tid == Seed_ppt[i]->tgid || (Seed_ppt[self]->tid == Seed_ppt[i]->ppid && Seed_ppt[i]->tid == Seed_ppt[i]->tgid)) diff --git a/top/top.h b/top/top.h index 903a5435..d45f0038 100644 --- a/top/top.h +++ b/top/top.h @@ -43,7 +43,7 @@ //#define STRINGCASENO /* case insenstive compare/locate versions */ //#define TERMIO_PROXY /* true line editing, beyond native input */ //#define TREE_NORESET /* sort keys do NOT force forest view OFF */ -//#define TREE_ONEPASS /* for speed, tolerate dangling children */ +//#define TREE_RESCANS /* restart scan to avoid dangling children */ //#define USE_X_COLHDR /* emphasize header vs. whole col, for 'x' */ //#define VALIDATE_NLS /* validate integrity of all 3 nls tables */ //#define WARN_CFG_OFF /* warning OFF when overwriting old rcfile */