Search code examples
javahttpservletstimemeasurement

How to measure the execution time of a servlet's method from client side java code?


I am writing a tool, which should be able to measure the execution time of a servlet's method from client side. Not the whole servlet's, only one method's. To measure the running time of the whole servlet, I set a start-time then created a URLConnection with the servlet's URL, opened the connection, got the inputstream, read the inputstream, closed the connection and then set an end-time and calculated the elapsed time with a subtraction. But this time I'd like to measure only one method of the servlet and avoid calculating parameter reading and checking and such thing. I guess it's only possible in the servlet itself, but I need the measured value sent back to the client side program. Is it possible somehow? Or am I on the wrong path?

Thanks in advance!


Solution

  • No, this is not possible. You do not have control over what and how is executed on the server side being on the client side.