Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get the server processing time

 
madhu gadde
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
slicker
Ranch Hand
Posts: 1108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic