title: Web service request exection time calculation
body: <p>I have a working SOAP web service implemented with CXF in Java. What would be a good way to calculate method execution on a server side?</p>
  
  <p>What I've done for now is I used interceptors. I've defined <code>public static long start</code> in my InInterceptor(Phase.RECEIVE). And in my OutInterceptor(Phase.SEND) I calculate response time like this :</p>
  
  <pre><code>    @Override
      public void handleMessage(Message arg0) {
          long stop = System.currentTimeMillis();
          long executionTime = stop - RequestStartInterceptor.start;
          System.out.println("execution time was ~" + executionTime + " ms");
      }
  </code></pre>
  
  <p>Is there a better way to do this? I was reading about execution of method trough proxy, but I have no clue how to do that.</p>
  
  <p>Question update :</p>
  
  <p>I've googled a bit more a find my way arround the second way using the proxy i.e :</p>
  
  <pre><code>@Aspect
  public class MyServiceProfiler {
  
  
  
       @Pointcut("execution(* gov.noaa.nhc.*.*(..))")
           public void myServiceMethods() { }
  
           @Around("myServiceMethods()")
           public Object profile(ProceedingJoinPoint pjp) throws Throwable {
                   long start = System.currentTimeMillis();
                   System.out.println("Going to call the method.");
                   Object output = pjp.proceed();
                   System.out.println("Method execution completed.");
                   long elapsedTime = System.currentTimeMillis() - start;
                   System.out.println("Method execution time: " + elapsedTime + " milliseconds.");
                   return output;
           }
      }
  </code></pre>
  
  <p>Based on comments to this question so far, using interceptors is better than using proxy. I'm looking to slow down the webservice as least as possible (this will certainly slow it down) and at the same time get a precise performance measurement.</p>