Tracing methods (Java applications only)

Use method tracing on Java™ applications to get accurate timings of method calls, and a breakdown of use across each running thread. Method tracing is not enabled by default, because you must first select the methods that you want to trace.

About this task

You enable method tracing when you start your application; you cannot enable tracing at run time. To identify methods that you want to trace, run Health Center and monitor your application for a while, using the Profiling view to examine the methods. If there are any methods that you want to get accurate timings for, stop your application, add a -Xtrace parameter for those methods to the command line, then restart the application. Health Center can generate the required trace parameters for you, from the Profiling view.

Note: Enabling method tracing on every method reduces performance, and your application will be affected if you choose to trace all methods.


  1. Run Health Center, then select the Profiling perspective to view the methods.
  2. From the Profiling table, select the methods that you want to trace, then right-click the mouse to display a menu.
  3. Select Generate method trace parameters > Copy parameters to clipboard.
    Health Center displays a message showing the required parameters, and adds the parameters to the clipboard.
  4. Stop the monitored application.
  5. Restart the application, adding the method trace parameters from the clipboard to the command line.
    For example:
    java -Xhealthcenter -Xtrace:maximal=mt,methods={"sun/reflect/GeneratedConstructorAccessor1.newInstance"} MyApplication

What to do next

Use the Method Trace perspective to view and analyze the trace information. For more details, see Method trace perspective.