You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2013/05/10 14:31:27 UTC
svn commit: r1480992 - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main:
java/org/apache/uima/ducc/ws/server/DuccHandler.java
webapp/root/job.details.table.processes.jsp
Author: degenaro
Date: Fri May 10 12:31:27 2013
New Revision: 1480992
URL: http://svn.apache.org/r1480992
Log:
UIMA-2878 DUCC webserver calculation and display of %CPU on Job Details page Processes tab
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=1480992&r1=1480991&r2=1480992&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 Fri May 10 12:31:27 2013
@@ -458,6 +458,7 @@ public class DuccHandler extends DuccAbs
sb.append(process.getReasonForStoppingProcess());
}
sb.append("</td>");
+ String initTime = "?";
// Time:initializationTimeWindow t;
long timeInitMillis = 0;
if(type.equals("MR")) {
@@ -474,7 +475,6 @@ public class DuccHandler extends DuccAbs
}
catch(Exception e) {
}
- String initTime = "?";
if(t != null) {
initTime = t.getElapsed(job);
}
@@ -660,16 +660,58 @@ public class DuccHandler extends DuccAbs
sb.append("</td>");
}
}
- /*
- // Time:cpu
+ // %cpu
sb.append("<td align=\"right\">");
- long timeCPU = process.getCpuTime();
- String fmtCPU = dateFormat.format(new Date(timeCPU));
- fmtCPU = chomp("00:", fmtCPU);
- sb.append(fmtCPU);
+ double pctCPU = 0;
+ String displayCPU = formatter.format(pctCPU);
+ boolean rt = false;
+ if(runTime != null) {
+ if(runTime.contains(":")) {
+ rt = true;
+ }
+ else {
+ try {
+ long value = Long.parseLong(runTime);
+ if(value > 0) {
+ rt = true;
+ }
+ }
+ catch(Exception e) {
+ }
+ }
+ }
+ try {
+ if(rt) {
+ long msecsCPU = process.getCpuTime()*1000;
+ long msecsRun = process.getTimeWindowRun().getElapsedMillis();
+ switch(process.getProcessState()) {
+ case Running:
+ long msecsInit = process.getTimeWindowInit().getElapsedMillis();
+ msecsRun = msecsRun - msecsInit;
+ break;
+ }
+ double secsCPU = (msecsCPU*1.0)/1000.0;
+ double secsRun = (msecsRun*1.0)/1000.0;
+ double timeCPU = secsCPU;
+ double timeRun = secsRun;
+ pctCPU = 100*(timeCPU/timeRun);
+ if(!Double.isNaN(pctCPU)) {
+ 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);
+ tb.append(fmtPctCPU);
+ tb.append("</span>");
+ displayCPU = tb.toString();
+ }
+ }
+ }
+ catch(Exception e) {
+ }
+ sb.append(displayCPU);
sb.append("</td>");
- */
-
/*
// %rss
DuccId duccId = job.getDuccId();
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=1480992&r1=1480991&r2=1480992&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 Fri May 10 12:31:27 2013
@@ -44,9 +44,7 @@ under the License.
-->
<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="Cumulative CPU time, hh:mm:ss">CPU</th>
- -->
+ <th title="%CPU time, as percentage of process 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>