]> granicus.if.org Git - procps-ng/commitdiff
top: revise default for forest view child scans
authorJim Warner <james.warner@comcast.net>
Wed, 4 Jul 2012 09:04:04 +0000 (04:04 -0500)
committerCraig Small <csmall@enc.com.au>
Wed, 29 Aug 2012 07:30:26 +0000 (17:30 +1000)
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 <james.warner@comcast.net>
top/top.c
top/top.h

index 572ade63873105d498e6af3b0b9d1bb50f49f589..bfe572764e5ad58a118356c79ba9ef99978986d9 100644 (file)
--- 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))
index 903a5435ba2c9e931851060fde002f5aef05575d..d45f00383e293863ddf698d7d7abdd69a79ae350 100644 (file)
--- 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 */