Author: degenaro
Date: Mon Apr 28 16:16:03 2014
New Revision: 1590696

URL: http://svn.apache.org/r1590696
Log:
UIMA-3769 DUCC Agent should include JP current CPU utilization (and WebServer 
should display accordingly)

Modified:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/job.details.table.processes.jsp

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java?rev=1590696&r1=1590695&r2=1590696&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
 Mon Apr 28 16:16:03 2014
@@ -728,8 +728,9 @@ public class DuccHandler extends DuccAbs
                // %cpu
                index++; // jp.15
                cbList[index].append("<td align=\"right\">");
-               double pctCPU = 0;
-               String displayCPU = formatter.format(pctCPU);
+               double pctCPU_overall = 0;
+               double pctCPU_current = 0;
+               String displayCPU = formatter.format(pctCPU_overall);
                if(process.getDataVersion() < 1) {
                        boolean rt = false;
                        if(runTime != null) {
@@ -761,14 +762,14 @@ public class DuccHandler extends DuccAbs
                                        double secsRun = (msecsRun*1.0)/1000.0;
                                        double timeCPU = secsCPU;
                                        double timeRun = secsRun;
-                                       pctCPU = 100*(timeCPU/timeRun);
-                                       if(!Double.isNaN(pctCPU)) {
+                                       pctCPU_overall = 100*(timeCPU/timeRun);
+                                       if(!Double.isNaN(pctCPU_overall)) {
                                                StringBuffer tb = new 
StringBuffer();
                                                String fmtsecsCPU = 
formatter.format(secsCPU);
                                                String fmtsecsRun = 
formatter.format(secsRun);
                                                String title = 
"title="+"\""+"seconds"+" "+"CPU:"+fmtsecsCPU+" "+"run:"+fmtsecsRun+"\"";
                                                tb.append("<span "+title+">");
-                                               String fmtPctCPU = 
formatter.format(pctCPU);
+                                               String fmtPctCPU = 
formatter.format(pctCPU_overall);
                                                tb.append(fmtPctCPU);
                                                tb.append("</span>");
                                                displayCPU = tb.toString();
@@ -779,12 +780,25 @@ public class DuccHandler extends DuccAbs
                        }
                }
                else {
-                       pctCPU = process.getCpuTime();
-                       String fmtPctCPU = formatter.format(pctCPU);
                        StringBuffer tb = new StringBuffer();
-                       tb.append("<span>");
-                       tb.append(fmtPctCPU);
-                       tb.append("</span>");
+                       pctCPU_overall = process.getCpuTime();
+                       pctCPU_current = process.getCurrentCPU();
+                       switch(process.getProcessState()) {
+                       case Running:
+                               String title = "title="+"\"lifetime: 
"+formatter.format(pctCPU_overall)+"\"";
+                               tb.append("<span "+title+" 
class=\"health_green\">");
+                               tb.append(formatter.format(pctCPU_current));
+                               tb.append("</span>");
+                               break;
+                       default:
+                               tb.append("<span>");
+                               tb.append(formatter.format(pctCPU_overall));
+                               tb.append("</span>");
+                               break;
+                       }
+                       
+                       
+                       
                        displayCPU = tb.toString();
                }
                cbList[index].append(displayCPU);

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/job.details.table.processes.jsp
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/job.details.table.processes.jsp?rev=1590696&r1=1590695&r2=1590696&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/job.details.table.processes.jsp
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/job.details.table.processes.jsp
 Mon Apr 28 16:16:03 2014
@@ -40,7 +40,7 @@ under the License.
        <th title="Process total time spent performing garbage collections, 
hh:mm:ss">Time<br>GC</th>
        <th title="Process count of major faults which required loading a 
memory page from disk">PgIn</th>
        <th title="Process GB swapped out to disk, current if state=running or 
maximum if state=completed">Swap</th>
-       <th title="%CPU time, as percentage of process lifetime">%CPU</th>
+       <th title="%CPU time, as percentage of process (over last reporting 
interval if active, else over lifetime)">%CPU</th>
        <th title="Resident Storage Size in GB, current if state=running or 
maximum if state=completed">RSS</th>
        <th title="Average seconds per work item">Time<br>Avg</th>
        <th title="Maximum seconds for any work item">Time<br>Max</th>


Reply via email to