public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: cagney@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Delete Host.requestRefreshXXX().
Date: Thu, 07 Feb 2008 19:06:00 -0000	[thread overview]
Message-ID: <20080207190653.4348.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  ec5156efde7f08f2adc5c459155e5abf4ea8477f (commit)
      from  2209847f5130a5b5d8ca5a4d5978f6d9d5f66ba8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit ec5156efde7f08f2adc5c459155e5abf4ea8477f
Author: Andrew Cagney <cagney@redhat.com>
Date:   Thu Feb 7 14:06:06 2008 -0500

    Delete Host.requestRefreshXXX().
    
    frysk-core/frysk/proc/ChangeLog
    2008-02-07  Andrew Cagney  <cagney@redhat.com>
    
    	* Host.java (requestRefreshXXX()): Delete.
    	* ProcBlockAction.java: Update.
    	* TestFindProc.java: Update.
    
    frysk-core/frysk/proc/dead/ChangeLog
    2008-02-07  Andrew Cagney  <cagney@redhat.com>
    
    	* DeadHost.java (requestRefreshXXX()): Delete.
    
    frysk-core/frysk/proc/dummy/ChangeLog
    2008-02-07  Andrew Cagney  <cagney@redhat.com>
    
    	* DummyHost.java (requestRefreshXXX()): Delete.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-02-07  Andrew Cagney  <cagney@redhat.com>
    
    	* LinuxPtraceHost.java (requestRefreshXXX()): Delete.
    	* TestTaskObserverBlocked.java: Update.
    
    frysk-gui/frysk/gui/ChangeLog
    2008-02-07  Andrew Cagney  <cagney@redhat.com>
    
    	* Gui.java: Delete call to Host.requestRefreshXXX().

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/proc/ChangeLog                    |    4 +
 frysk-core/frysk/proc/Host.java                    |    7 --
 frysk-core/frysk/proc/ProcBlockAction.java         |    1 -
 .../StressAttachDetachRapidlyForkingMainTask.java  |   28 ++++--
 frysk-core/frysk/proc/TestFindProc.java            |   18 ----
 frysk-core/frysk/proc/dead/ChangeLog               |    2 +
 frysk-core/frysk/proc/dead/DeadHost.java           |    3 -
 frysk-core/frysk/proc/dummy/ChangeLog              |    2 +
 frysk-core/frysk/proc/dummy/DummyHost.java         |    3 -
 frysk-core/frysk/proc/live/ChangeLog               |    3 +
 frysk-core/frysk/proc/live/LinuxPtraceHost.java    |   11 --
 .../frysk/proc/live/TestTaskObserverBlocked.java   |  104 ++++++++++----------
 frysk-gui/frysk/gui/ChangeLog                      |    4 +
 frysk-gui/frysk/gui/Gui.java                       |   44 ++++++---
 14 files changed, 116 insertions(+), 118 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index 213f63a..a30eb3f 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,5 +1,9 @@
 2008-02-07  Andrew Cagney  <cagney@redhat.com>
 
+	* Host.java (requestRefreshXXX()): Delete.
+	* ProcBlockAction.java: Update.
+	* TestFindProc.java: Update.
+	
 	* FindProc.java (procNotFound(int)): Replace procNotFound(ProcId).
 	* Host.java (requestProc(int,FindProc)): Replace
 	requestProc(ProcId,FindProc).
diff --git a/frysk-core/frysk/proc/Host.java b/frysk-core/frysk/proc/Host.java
index addd620..c3f8a95 100644
--- a/frysk-core/frysk/proc/Host.java
+++ b/frysk-core/frysk/proc/Host.java
@@ -128,13 +128,6 @@ public abstract class Host {
 
 
     /**
-     * Request that the Host scan the system's process tables
-     * refreshing the internal structure to match.  Optionally refresh
-     * each processes task list.
-     */
-    public abstract void requestRefreshXXX();
-
-    /**
      * Find a specifc process from its Id.
      */
     public abstract void requestProc(int pid, FindProc finder);
diff --git a/frysk-core/frysk/proc/ProcBlockAction.java b/frysk-core/frysk/proc/ProcBlockAction.java
index 049f81f..dadbcc3 100644
--- a/frysk-core/frysk/proc/ProcBlockAction.java
+++ b/frysk-core/frysk/proc/ProcBlockAction.java
@@ -170,7 +170,6 @@ public class ProcBlockAction
   public ProcBlockAction (File coreFile) {
     LinuxCoreHost core = new LinuxCoreHost(Manager.eventLoop, coreFile);
 
-    core.requestRefreshXXX();
     Manager.eventLoop.runPending();
     proc = core.getSoleProcFIXME();
     if (proc == null)
diff --git a/frysk-core/frysk/proc/StressAttachDetachRapidlyForkingMainTask.java b/frysk-core/frysk/proc/StressAttachDetachRapidlyForkingMainTask.java
index 9aa62ca..d0652ab 100644
--- a/frysk-core/frysk/proc/StressAttachDetachRapidlyForkingMainTask.java
+++ b/frysk-core/frysk/proc/StressAttachDetachRapidlyForkingMainTask.java
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2005, 2006, 2007, Red Hat Inc.
+// Copyright 2005, 2006, 2007, 2008, Red Hat Inc.
 //
 // FRYSK is free software; you can redistribute it and/or modify it
 // under the terms of the GNU General Public License as published by
@@ -39,6 +39,8 @@
 
 package frysk.proc;
 
+import java.util.Collection;
+import java.util.HashSet;
 import java.util.logging.Level;
 import frysk.event.TimerEvent;
 import frysk.proc.ProcObserver.ProcTasks;
@@ -156,13 +158,23 @@ public class StressAttachDetachRapidlyForkingMainTask
 	child.getMainTask().requestAddForkedObserver (forkObserver);
 	
 	// Create a refresh time with a low refresh.
-	TimerEvent refreshTimer = new TimerEvent(0, 500){
-		public void execute() {
-		    Manager.host.requestRefreshXXX ();
-		}
-	    };
-
-	Manager.eventLoop.add (refreshTimer);
+	class Refresher extends TimerEvent implements HostRefreshBuilder {
+	    private final Host host;
+	    Refresher(Host host) {
+		super(0, 500);
+		this.host = host;
+	    }
+	    private final HashSet known = new HashSet();
+	    public void execute() {
+		host.requestRefresh(known, this);
+	    }
+	    public void construct(Collection newProcesses,
+				  Collection exitedProcesses) {
+		known.addAll(newProcesses);
+		known.removeAll(exitedProcesses);
+	    }
+	}
+	Manager.eventLoop.add (new Refresher(host));
 	
 	// Go ....
 	child.requestRemoveBlock();
diff --git a/frysk-core/frysk/proc/TestFindProc.java b/frysk-core/frysk/proc/TestFindProc.java
index 2819c87..7dcab2c 100644
--- a/frysk-core/frysk/proc/TestFindProc.java
+++ b/frysk-core/frysk/proc/TestFindProc.java
@@ -145,22 +145,4 @@ public class TestFindProc
 	Manager.host.requestProc(0, finder);
 	assertRunUntilStop("testFindFailed");
     }
-  
-
-  public void testFindUsingRefresh ()
-  {
-    final SlaveOffspring ackProc = SlaveOffspring.createChild();
-
-    Proc proc;
-
-    ProcCounter o = new ProcCounter();
-    Manager.host.observableProcAddedXXX.addObserver(o);
-    // Try polling /proc.
-    Manager.host.requestRefreshXXX();
-    Manager.eventLoop.runPending();
-    proc = Manager.host.getProc(new ProcId(ackProc.getPid()));
-
-    assertNotNull(proc);
-
-  }
 }
diff --git a/frysk-core/frysk/proc/dead/ChangeLog b/frysk-core/frysk/proc/dead/ChangeLog
index 71703d3..cbb951b 100644
--- a/frysk-core/frysk/proc/dead/ChangeLog
+++ b/frysk-core/frysk/proc/dead/ChangeLog
@@ -1,5 +1,7 @@
 2008-02-07  Andrew Cagney  <cagney@redhat.com>
 
+	* DeadHost.java (requestRefreshXXX()): Delete.
+
 	* DeadHost.java (requestProc(int,FindProc): Update to match Host.
 
 2008-01-31  Andrew Cagney  <cagney@redhat.com>
diff --git a/frysk-core/frysk/proc/dead/DeadHost.java b/frysk-core/frysk/proc/dead/DeadHost.java
index f84d235..127a735 100644
--- a/frysk-core/frysk/proc/dead/DeadHost.java
+++ b/frysk-core/frysk/proc/dead/DeadHost.java
@@ -61,9 +61,6 @@ abstract class DeadHost extends Host {
 					  Attached attached) {
 	throw new RuntimeException("requestCreateAttachedProc");
     }
-    public void requestRefreshXXX() {
-	// ignore.
-    }
     public void requestRefresh(Collection knownProcesses,
 			       HostRefreshBuilder builder) {
 	// Ignore for now; should call back with the known processes
diff --git a/frysk-core/frysk/proc/dummy/ChangeLog b/frysk-core/frysk/proc/dummy/ChangeLog
index bb6d338..9389c51 100644
--- a/frysk-core/frysk/proc/dummy/ChangeLog
+++ b/frysk-core/frysk/proc/dummy/ChangeLog
@@ -1,5 +1,7 @@
 2008-02-07  Andrew Cagney  <cagney@redhat.com>
 
+	* DummyHost.java (requestRefreshXXX()): Delete.	
+
 	* DummyHost.java (requestProc(int,FindProc)): Update to match
 	Host.
 
diff --git a/frysk-core/frysk/proc/dummy/DummyHost.java b/frysk-core/frysk/proc/dummy/DummyHost.java
index aeae459..0378669 100644
--- a/frysk-core/frysk/proc/dummy/DummyHost.java
+++ b/frysk-core/frysk/proc/dummy/DummyHost.java
@@ -47,9 +47,6 @@ import java.util.Collection;
 import frysk.proc.HostRefreshBuilder;
 
 public class DummyHost extends Host {
-    public void requestRefreshXXX() {
-	throw new RuntimeException("requestCreateAttachedProc");
-    }
     public void requestCreateAttachedProc(String stdin, String stdout,
 					  String stderr, String[] args,
 					  Attached attached) {
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index e515865..c38ab2b 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,5 +1,8 @@
 2008-02-07  Andrew Cagney  <cagney@redhat.com>
 
+	* LinuxPtraceHost.java (requestRefreshXXX()): Delete.
+	* TestTaskObserverBlocked.java: Update.
+	
 	* LinuxPtraceHost.java (requestProc(int,FindProc)): Update to
 	match host.
 
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceHost.java b/frysk-core/frysk/proc/live/LinuxPtraceHost.java
index 167fc5c..67ae93b 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceHost.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceHost.java
@@ -156,17 +156,6 @@ public class LinuxPtraceHost extends LiveHost {
 	}
     }
 
-
-    public void requestRefreshXXX() {
-	logger.log(Level.FINEST, "{0} requestRefreshXXX\n", this); 
-	Manager.eventLoop.add(new Event() {
-		public void execute() {
-		    logger.log(Level.FINE, "{0} handleRefresh\n",
-			       LinuxPtraceHost.this); 
-		    LinuxPtraceHost.this.executeRefresh();
-		}
-	    });
-    }
     private ProcChanges executeRefresh() {
 	// Iterate (build) the /proc tree, passing each found PID to
 	// procChanges where it can update the /proc tree.
diff --git a/frysk-core/frysk/proc/live/TestTaskObserverBlocked.java b/frysk-core/frysk/proc/live/TestTaskObserverBlocked.java
index 289bf50..e18519e 100644
--- a/frysk-core/frysk/proc/live/TestTaskObserverBlocked.java
+++ b/frysk-core/frysk/proc/live/TestTaskObserverBlocked.java
@@ -52,8 +52,11 @@ import frysk.testbed.Offspring;
 import frysk.testbed.SlaveOffspring;
 import frysk.proc.TaskObserver;
 import frysk.proc.Task;
+import frysk.proc.HostRefreshBuilder;
 import frysk.proc.Action;
 import frysk.proc.Manager;
+import java.util.Collection;
+import java.util.HashSet;
 
 /**
  * Check the behavior of an observer that blocks a Task's progress. In
@@ -393,59 +396,56 @@ public class TestTaskObserverBlocked
     fork.assertUnblockOffspring();
   }
 
-  /**
-   * Check that an unblocked offspring, that then exits, can be refreshed. This
-   * confirms that an unblocked task transitioned to detached.
-   */
-  public void testRefreshAfterUnblockedForkExits ()
-  {
-    SlaveOffspring proc = SlaveOffspring.createDaemon();
-    Task task = proc.findTaskUsingRefresh(true);
-    class ForkUnblock
-        extends TaskObserverBase
-        implements TaskObserver.Forked
-    {
-      Task parent;
-
-      Task offspring;
-
-      public void addedTo (Object o)
-      {
-        Manager.eventLoop.requestStop();
-      }
-
-      public Action updateForkedParent (Task parent, Task offspring)
-      {
-        this.parent = parent;
-        this.offspring = offspring;
-        return Action.CONTINUE;
-      }
-
-      public Action updateForkedOffspring (Task parent, Task offspring)
-      {
-        offspring.requestUnblock(this);
-        return Action.BLOCK;
-      }
+    /**
+     * Check that an unblocked offspring, that exits can be
+     * refreshed. This confirms that an unblocked task transitioned to
+     * detached.
+     */
+    public void testRefreshAfterUnblockedForkExits() {
+	SlaveOffspring proc = SlaveOffspring.createDaemon();
+	Task task = proc.findTaskUsingRefresh(true);
+	class ForkUnblock extends TaskObserverBase
+	    implements TaskObserver.Forked
+	{
+	    Task parent;
+	    Task offspring;
+	    public void addedTo (Object o) {
+		Manager.eventLoop.requestStop();
+	    }
+	    public Action updateForkedParent (Task parent, Task offspring) {
+		this.parent = parent;
+		this.offspring = offspring;
+		return Action.CONTINUE;
+	    }
+	    public Action updateForkedOffspring (Task parent, Task offspring) {
+		offspring.requestUnblock(this);
+		return Action.BLOCK;
+	    }
+	}
+	ForkUnblock forkUnblock = new ForkUnblock();
+	task.requestAddForkedObserver(forkUnblock);
+	assertRunUntilStop("adding fork observer");
+
+	// Create a child process, will transition through to
+	// detached.
+	proc.assertSendAddForkWaitForAcks();
+
+	// Now make the child exit. Frysk's core can't see this since
+	// it isn't attached to the process.
+	proc.assertSendDelForkWaitForAcks();
+
+	logger.log(Level.FINE, "{0} parent\n", forkUnblock.parent);
+	logger.log(Level.FINE, "{0} offspring\n", forkUnblock.offspring);
+
+	// Finally force a refresh.
+	host.requestRefresh(new HashSet(), new HostRefreshBuilder() {
+		public void construct(Collection newProcesses,
+				      Collection exitedProcesses) {
+		    // ignore; check in exitedProcesses?
+		}
+	    });
+	Manager.eventLoop.runPending();
     }
-    ForkUnblock forkUnblock = new ForkUnblock();
-    task.requestAddForkedObserver(forkUnblock);
-    assertRunUntilStop("adding fork observer");
-
-    // Create a child process, will transition through to
-    // detached.
-    proc.assertSendAddForkWaitForAcks();
-
-    // Now make the child exit. Frysk's core can't see this since
-    // it isn't attached to the process.
-    proc.assertSendDelForkWaitForAcks();
-
-    logger.log(Level.FINE, "{0} parent\n", forkUnblock.parent);
-    logger.log(Level.FINE, "{0} offspring\n", forkUnblock.offspring);
-
-    // Finally force a refresh.
-    host.requestRefreshXXX();
-    Manager.eventLoop.runPending();
-  }
 
   /**
    * Check that new observers being added hot on the heals of an unblock get
diff --git a/frysk-gui/frysk/gui/ChangeLog b/frysk-gui/frysk/gui/ChangeLog
index db5f960..247fa8a 100644
--- a/frysk-gui/frysk/gui/ChangeLog
+++ b/frysk-gui/frysk/gui/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-07  Andrew Cagney  <cagney@redhat.com>
+
+	* Gui.java: Delete call to Host.requestRefreshXXX().
+
 2008-01-24  Andrew Cagney  <cagney@redhat.com>
 
 	* register/RegisterWindow.java: Update; Register moved to
diff --git a/frysk-gui/frysk/gui/Gui.java b/frysk-gui/frysk/gui/Gui.java
index 4261577..04ce0ba 100644
--- a/frysk-gui/frysk/gui/Gui.java
+++ b/frysk-gui/frysk/gui/Gui.java
@@ -39,6 +39,10 @@
 
 package frysk.gui;
 
+import frysk.proc.HostRefreshBuilder;
+import java.util.Collection;
+import java.util.HashSet;
+import frysk.proc.Host;
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -376,21 +380,31 @@ public class Gui implements LifeCycleListener, Saveable {
 		});
 		backendStarter.start();
 		
-		TimerEvent refreshTimer = new TimerEvent(0, 3000)
-		    {
-			public void execute()
-			{
-			    CustomEvents.addEvent(new Runnable()
-				{
-				    public void run()
-				    {
-					Manager.host.requestRefreshXXX();
-				    }
-				});
-			}
-		    };
-		Manager.eventLoop.add(refreshTimer);
-
+		// Create a refresh time with a low refresh; FIXME:
+		// This belongs in the process-picker window.  That
+		// way the process picker gets to regulate when
+		// updates come through.  For instance, while a search
+		// (CNTRL-F) is being performed, refreshes are
+		// blocked.
+		class Refresher extends
+		    TimerEvent implements HostRefreshBuilder
+		{
+		    private final Host host;
+		    Refresher(Host host) {
+			super(0, 3000);
+			this.host = host;
+		    }
+		    private final HashSet known = new HashSet();
+		    public void execute() {
+			host.requestRefresh(known, this);
+		    }
+		    public void construct(Collection newProcesses,
+					  Collection exitedProcesses) {
+			known.addAll(newProcesses);
+			known.removeAll(exitedProcesses);
+		    }
+		}
+		Manager.eventLoop.add (new Refresher(Manager.host));
 	}
 	
 	/**


hooks/post-receive
--
frysk system monitor/debugger


                 reply	other threads:[~2008-02-07 19:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080207190653.4348.qmail@sourceware.org \
    --to=cagney@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).