Author: mes
Date: 2011-09-21 14:26:19 -0700 (Wed, 21 Sep 2011)
New Revision: 26914

Modified:
   
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/SwingTaskManager.java
Log:
added task execution timing information

Modified: 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/SwingTaskManager.java
===================================================================
--- 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/SwingTaskManager.java
  2011-09-21 18:11:56 UTC (rev 26913)
+++ 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/SwingTaskManager.java
  2011-09-21 21:26:19 UTC (rev 26914)
@@ -132,6 +132,7 @@
 
        @Override
        public void execute(final TaskFactory factory) {
+
                final SwingTaskMonitor taskMonitor = new 
SwingTaskMonitor(cancelExecutorService, parent);
                
                TaskIterator taskIterator;
@@ -162,15 +163,16 @@
                        logger.warn("Caught exception getting and validating 
task. ", exception);       
                        taskMonitor.showException(exception);
                        return;
-               }
+               } 
 
                // create the task thread
-               final Runnable tasks = new TaskThread(first, taskMonitor, 
taskIterator); 
+               final Runnable tasks = new TaskThread(first, taskMonitor, 
taskIterator, factory.getClass().getName()); 
 
                // submit the task thread for execution
                final Future<?> executorFuture = 
taskExecutorService.submit(tasks);
 
                openTaskMonitorOnDelay(taskMonitor, executorFuture);
+
        }
 
        // This creates a thread on delay that conditionally displays the task 
monitor gui
@@ -193,14 +195,17 @@
                private final SwingTaskMonitor taskMonitor;
                private final TaskIterator taskIterator;
                private final Task first;
+               private final String name;
 
-               TaskThread(final Task first, final SwingTaskMonitor tm, final 
TaskIterator ti) {
+               TaskThread(final Task first, final SwingTaskMonitor tm, final 
TaskIterator ti, final String name) {
                        this.first = first;
                        this.taskMonitor = tm;
                        this.taskIterator = ti;
+                       this.name = name;
                }
                
                public void run() {
+                       final long start = System.currentTimeMillis();
                        try {
                                // actually run the first task 
                                // don't dispaly the tunables here - they were 
handled above. 
@@ -231,6 +236,9 @@
                        // clean up the task monitor
                        if (taskMonitor.isOpened() && 
!taskMonitor.isShowingException())
                                taskMonitor.close();
+
+                       final long end = System.currentTimeMillis();
+                       logger.info("TASK (" + name + ") completed in: " + (end 
- start) + " ms");
                }
        }
 

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to