Index: trunk/Ohana/src/opihi/pantasks/CheckController.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckController.c	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/CheckController.c	(revision 4763)
@@ -38,5 +38,6 @@
   gettimeofday (&stop, (void *) NULL);
   dtime = DTIME (stop, start);
-  if (VerboseMode()) fprintf (stderr, "check stack %f\n", dtime);
+  if (VerboseMode()) fprintf (stderr, "check exit stack %f\n", dtime);
+  /* if (Njobs) fprintf (stderr, "check exit stack %f\n", dtime); */
   gettimeofday (&start, (void *) NULL);
 
@@ -61,5 +62,6 @@
   gettimeofday (&stop, (void *) NULL);
   dtime = DTIME (stop, start);
-  if (VerboseMode()) fprintf (stderr, "check %d jobs %f\n", i, dtime);
+  /* if (VerboseMode()) fprintf (stderr, "clear %d exit jobs %f\n", i, dtime); */
+  gettimeofday (&start, (void *) NULL);
 
   if (TestElapsedCheck()) return (TRUE);
@@ -85,4 +87,9 @@
   }
 
+  gettimeofday (&stop, (void *) NULL);
+  dtime = DTIME (stop, start);
+  /* if (VerboseMode()) fprintf (stderr, "check crash stack %f\n", dtime); */
+  gettimeofday (&start, (void *) NULL);
+
   p = buffer.buffer;
   for (i = 0; (i < Njobs) && !TestElapsedCheck(); i++) {
@@ -104,4 +111,8 @@
   }
   FreeIOBuffer (&buffer);
+
+  gettimeofday (&stop, (void *) NULL);
+  dtime = DTIME (stop, start);
+  /* if (VerboseMode()) fprintf (stderr, "clear %d crash jobs %f\n", i, dtime); */
   return (TRUE);
 }
Index: trunk/Ohana/src/opihi/pantasks/CheckJobs.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 4763)
@@ -17,9 +17,9 @@
     switch (status) {
       case JOB_PENDING:
-	if (VerboseMode()) fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID);
+	/* if (VerboseMode()) fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */
 	break;
 
       case JOB_BUSY:
-	if (VerboseMode()) fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID);
+	/* if (VerboseMode()) fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */
 	break;
 
Index: trunk/Ohana/src/opihi/pantasks/CheckSystem.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckSystem.c	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/CheckSystem.c	(revision 4763)
@@ -9,5 +9,5 @@
   gettimeofday (&start, (void *) NULL);
 
-  if (Ncheck < 5) {
+  if (Ncheck < 20) {
     CheckTasks ();
     CheckJobs ();
Index: trunk/Ohana/src/opihi/pantasks/ControllerOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 4763)
@@ -25,5 +25,5 @@
   gettimeofday (&stop, (void *) NULL);
   dtime = DTIME (stop, start);
-  if (VerboseMode()) fprintf (stderr, "check job status %f\n", dtime);
+  /* if (VerboseMode()) fprintf (stderr, "check job status %f\n", dtime); */
 
   if ((job[0].state == JOB_EXIT) || (job[0].state == JOB_CRASH)) {
@@ -32,8 +32,17 @@
     gettimeofday (&stop, (void *) NULL);
     dtime = DTIME (stop, start);
-    if (VerboseMode()) fprintf (stderr, "get stdout %f\n", dtime);
-
+    /* if (VerboseMode()) fprintf (stderr, "get stdout %f\n", dtime); */
+
+    gettimeofday (&start, (void *) NULL);
     GetJobOutput ("stderr", job[0].pid, &job[0].stderr, job[0].stderr_size);
+    gettimeofday (&stop, (void *) NULL);
+    dtime = DTIME (stop, start);
+    /* if (VerboseMode()) fprintf (stderr, "get stderr %f\n", dtime); */
+
+    gettimeofday (&start, (void *) NULL);
     DeleteControllerJob (job);
+    gettimeofday (&stop, (void *) NULL);
+    dtime = DTIME (stop, start);
+    /* if (VerboseMode()) fprintf (stderr, "delete job %f\n", dtime); */
   }  
   return (TRUE);
@@ -138,5 +147,5 @@
   if (status == -1) return (CONTROLLER_HUNG);
 
-  if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd);  
+  /* if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd);   */
   /* drop extra bytes from pcontrol (not pclient:job) */
   buffer[0].Nbuffer = Nstart + Nbytes;
@@ -328,10 +337,8 @@
   FlushIOBuffer (buffer);
 
-  if (VerboseMode()) fprintf (stderr, "send: %s\n", cmd);
-
   /* send command, is pipe still open? */
   status = write_fmt (stdin_cntl, "%s\n", cmd);
   if ((status == -1) && (errno == EPIPE)) {
-    ControllerStatus = FALSE;
+    StopController ();
     if (VerboseMode()) fprintf (stderr, "controller is down\n");
     return (FALSE);
@@ -347,9 +354,10 @@
   }
   if (status ==  0) {
-    ControllerStatus = FALSE;
+    StopController ();
     if (VerboseMode()) fprintf (stderr, "controller is down\n");
     return (FALSE);
   }
   if (status == -1) {
+    StopController ();
     if (VerboseMode()) fprintf (stderr, "controller is not responding\n");
     return (FALSE);
@@ -362,5 +370,5 @@
     bzero (buffer[0].buffer + buffer[0].Nbuffer, buffer[0].Nalloc - buffer[0].Nbuffer);
   }
-  if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i);
+  /* if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i); */
   return (TRUE);
 }
@@ -428,5 +436,5 @@
 int QuitController () {
 
-  int i, status, waitstatus, result;
+  int status;
   char cmd[128];
   IOBuffer buffer;
@@ -436,6 +444,18 @@
   sprintf (cmd, "quit");
   InitIOBuffer (&buffer, 0x100);
-  status = ControllerCommand (cmd, CONTROLLER_PROMPT, &buffer);
-  FreeIOBuffer (&buffer);
+  status = ControllerCommand (cmd, "", &buffer);
+  FreeIOBuffer (&buffer);
+
+  /* the quit command does not return a prompt, so we always 
+     get an error on the controller here */
+  StopController ();
+  return (TRUE);
+}
+
+int StopController () {
+
+  int i, waitstatus, result;
+
+  if (!ControllerStatus) return (TRUE);
 
   ControllerStatus = FALSE;
@@ -451,5 +471,4 @@
   FreeIOBuffer (&stdout_buffer);
   FreeIOBuffer (&stderr_buffer);
-
-  return (TRUE);
-}
+  return (TRUE);
+}
Index: trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4763)
@@ -51,4 +51,5 @@
 $(SDIR)/controller_status.$(ARCH).o \
 $(SDIR)/controller_output.$(ARCH).o \
+$(SDIR)/controller_pulse.$(ARCH).o \
 $(SDIR)/task.$(ARCH).o \
 $(SDIR)/task_host.$(ARCH).o \
Index: trunk/Ohana/src/opihi/pantasks/controller.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller.c	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/controller.c	(revision 4763)
@@ -6,4 +6,5 @@
 int controller_check   PROTO((int, char **));
 int controller_output  PROTO((int, char **));
+int controller_pulse   PROTO((int, char **));
 
 static Command controller_cmds[] = {
@@ -13,4 +14,5 @@
   {"status", controller_status, "check controller status"},
   {"output", controller_output, "print controller output"},
+  {"pulse",  controller_pulse,  "set controller pulse"},
 };
 
Index: trunk/Ohana/src/opihi/pantasks/controller_host.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_host.c	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/controller_host.c	(revision 4763)
@@ -22,2 +22,8 @@
   return (TRUE);
 }
+
+/* should I keep an internal host table so I can reload the 
+   hosts if the controller exits?
+
+   alternatively, that could be a user-level choice
+*/
Index: trunk/Ohana/src/opihi/pantasks/controller_pulse.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_pulse.c	(revision 4763)
+++ trunk/Ohana/src/opihi/pantasks/controller_pulse.c	(revision 4763)
@@ -0,0 +1,23 @@
+# include "psched.h"
+
+int controller_pulse (int argc, char **argv) {
+
+  int status;
+  char command[1024];
+  IOBuffer buffer;
+
+  if (argc != 2) {
+    fprintf (stderr, "USAGE: controller pulse (usec)\n");
+    return (FALSE);
+  }
+
+  /* start controller connection (if needed) */
+  StartController ();
+
+  sprintf (command, "pulse %d", atoi(argv[1]));
+  InitIOBuffer (&buffer, 0x100);
+  status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
+  if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
+  FreeIOBuffer (&buffer);
+  return (TRUE);
+}
Index: trunk/Ohana/src/opihi/pantasks/controller_status.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 4763)
@@ -22,7 +22,10 @@
   InitIOBuffer (&buffer, 0x100);
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
-  if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
+  if (status) {
+    fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
+  } else {
+    fprintf (stderr, "controller is down\n");
+  }
   FreeIOBuffer (&buffer);
   return (TRUE);
-
 }
Index: trunk/Ohana/src/opihi/pantasks/psched.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/psched.c	(revision 4762)
+++ trunk/Ohana/src/opihi/pantasks/psched.c	(revision 4763)
@@ -41,4 +41,7 @@
 
   signal (SIGINT, SIG_IGN);
+  signal (SIGPIPE, gotsignal);
+  signal (SIGTSTP, gotsignal);
+  signal (SIGTTIN, gotsignal);
   return;
 }
@@ -57,2 +60,7 @@
   return;
 }
+
+void gotsignal (int signum) {
+  fprintf (stderr, "got signal : %d\n", signum);
+  return;
+}
