From: fhanik Date: Thu, 4 Oct 2007 14:20:13 +0000 (+0000) Subject: fix request processing stats X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=26e5b6ec3c6efa6f61ede090e9d4608dc3d0efe5;p=tomcat7.0 fix request processing stats git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@581920 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/RequestInfo.java b/java/org/apache/coyote/RequestInfo.java index 6a84d772e..ce45d589a 100644 --- a/java/org/apache/coyote/RequestInfo.java +++ b/java/org/apache/coyote/RequestInfo.java @@ -112,7 +112,8 @@ public class RequestInfo { } public long getRequestProcessingTime() { - return (System.currentTimeMillis() - req.getStartTime()); + if ( getStage() == org.apache.coyote.Constants.STAGE_ENDED ) return 0; + else return (System.currentTimeMillis() - req.getStartTime()); } // -------------------- Statistical data -------------------- @@ -130,6 +131,9 @@ public class RequestInfo { private int requestCount; // number of response codes >= 400 private int errorCount; + + //the time of the last request + private long lastRequestProcessingTime = 0; /** Called by the processor before recycling the request. It'll collect @@ -145,6 +149,7 @@ public class RequestInfo { long t0=req.getStartTime(); long t1=System.currentTimeMillis(); long time=t1-t0; + this.lastRequestProcessingTime = time; processingTime+=time; if( maxTime < time ) { maxTime=time; @@ -224,6 +229,10 @@ public class RequestInfo { return rpName; } + public long getLastRequestProcessingTime() { + return lastRequestProcessingTime; + } + public void setWorkerThreadName(String workerThreadName) { this.workerThreadName = workerThreadName; } @@ -231,4 +240,8 @@ public class RequestInfo { public void setRpName(ObjectName rpName) { this.rpName = rpName; } + + public void setLastRequestProcessingTime(long lastRequestProcessingTime) { + this.lastRequestProcessingTime = lastRequestProcessingTime; + } }