UIMA-6044 modified to fix cpu reportoing for POPs.

git-svn-id: https://svn.apache.org/repos/asf/uima/uima-ducc/trunk@1864726 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java b/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java
index d1a3442..9f8d90c 100644
--- a/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java
+++ b/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java
@@ -199,26 +199,19 @@
   private long getCpuTime(long totalCpuUsageInNanos) throws Exception {
     long cp = -1;
     if (agent.useCgroups) {
-      if (managedProcess.getDuccProcess().getProcessState().equals(ProcessState.Running)
-              || managedProcess.getDuccProcess().getProcessState()
-                      .equals(ProcessState.Initializing)) {
-
-        long timeRunning = 1;
-        if (process.getTimeWindowInit() != null) {
-          timeRunning = process.getTimeWindowInit().getElapsedMillis();
-        }
-        if (process.getTimeWindowRun() != null) {
-          timeRunning += process.getTimeWindowRun().getElapsedMillis();
-        }
-        long totalCpuUsageInMillis = totalCpuUsageInNanos / 1000000;
-        // normalize time in running state into seconds
-        percentCPU = Math.round(100 * ((totalCpuUsageInMillis * 1.0) / (timeRunning * 1.0)));
-
-        cp = percentCPU;
-
-      } else {
-        cp = percentCPU;
+      long timeRunning = 1;
+      if (process.getTimeWindowInit() != null) {
+        timeRunning = process.getTimeWindowInit().getElapsedMillis();
       }
+      if (process.getTimeWindowRun() != null) {
+        timeRunning += process.getTimeWindowRun().getElapsedMillis();
+      }
+      long totalCpuUsageInMillis = totalCpuUsageInNanos / 1000000;
+      // normalize time in running state into seconds
+      percentCPU = Math.round(100 * ((totalCpuUsageInMillis * 1.0) / (timeRunning * 1.0)));
+
+      cp = percentCPU;
+
     }
 
     return cp;