[padb] r337 committed - When running in proc-summary mode only pause for a second if the perce...

padb at googlecode.com padb at googlecode.com
Wed Nov 25 17:50:52 GMT 2009


Revision: 337
Author: apittman
Date: Wed Nov 25 09:50:16 2009
Log: When running in proc-summary mode only pause for a second if the  
percent cpu
figures are going to be displayed to the user.

http://code.google.com/p/padb/source/detail?r=337

Modified:
  /trunk/src/padb

=======================================
--- /trunk/src/padb	Wed Nov 25 09:36:55 2009
+++ /trunk/src/padb	Wed Nov 25 09:50:16 2009
@@ -7381,7 +7381,24 @@
      }

      if ( $carg->{proc_shows_proc} ) {
-        sleep 1;
+
+        # We only need to sleep if we are sampling the jiffy count for
+        # this process, otherwise there is no need and it shows padb down
+        # considerably.
+        my $should_sleep = 1;
+        if ( defined $carg->{proc_format} ) {
+            $should_sleep = 0;
+            if (   defined $proc_keys{pcpu}
+                or defined $proc_keys{pucpu}
+                or defined $proc_keys{pscpu} )
+            {
+                $should_sleep = 1;
+            }
+        }
+
+        if ($should_sleep) {
+            sleep 1;
+        }

          seek $SFD, 0, 0;

@@ -7393,11 +7410,12 @@
              my $h = $proc->{handle};
              $proc->{stat_end} = <$h>;
              close $proc->{handle};
-	    # Set handle to undef to prepare for future iterations of the
-	    # loop if being run in watch mode.  Without this handle remains
-	    # set but refers to the closed fd which causes errors next time
-	    # round the loop if the open fails.
-	    $proc->{handle} = undef;
+
+            # Set handle to undef to prepare for future iterations of the
+            # loop if being run in watch mode.  Without this handle remains
+            # set but refers to the closed fd which causes errors next time
+            # round the loop if the open fails.
+            $proc->{handle} = undef;
          }

          seek $SFD, 0, 0;




More information about the padb-devel mailing list