File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes how to get the server processing time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to get the server processing time" Watch "how to get the server processing time" New topic

how to get the server processing time

madhu gadde

Joined: May 27, 2005
Posts: 11
Hi all,

I need to know how long the server/servlet has taken to process a particular request. Could anybody help me in finding the servlet's processing time.

Thanks in Advance
Madhu Gadde
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
Have a filter intercept the Request. Note the time before and after invoking the doFilter method. The difference will give you the processing time for the request. But this won't include the network delay.
John Dunn
Ranch Hand

Joined: Jan 30, 2003
Posts: 1108
put this in doGet():

long appStartTime = System.currentTimeInMillis();

Now any time you want a time marker you subtract appStartTime from System.currentTimeInMillis();

I get one buffer at start of doGet(), put log messages in along the way with an elapsed time and print once at the end. This way I can filter the log file for specific log points and get the elapsed time.

"No one appreciates the very special genius of your conversation as the dog does."
jQuery in Action, 3rd edition
subject: how to get the server processing time
It's not a secret anymore!