• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Time taken by a request

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Team
Is there any method in java to calculate the time taken by a request to travel from browser to server and back to browser. I want to calculate the time taken by each request sent and received.

Thanks in advance

Ram Jeevi
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In order to measure the total travel time you need custom code on the client side to emulate a browser or a specialized browser plugin.

You could use the standard Java library classes in the java.net and java.io packages and the System.currentTimeMillis() method to time a single request/response cycle. If you just want to measure the time in the servlet, ignoring network time, use currentTimeMillis in your doGet etc method.

The Apache HttpClient toolkit could be used for more complex testing.

Bill
[ December 12, 2008: Message edited by: William Brogden ]
 
Water proof donuts! Eat them while reading this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic