IBM User Guide for Java V7 on Windows > Troubleshooting and support > Using diagnostic tools > Tracing Java applications and the JVM > Controlling the trace > Detailed descriptions of trace options
methods=<method_specification>[,<method_specification>]
Using method trace provides a complete (and potentially large) diagnosis of code paths inside your application and the system classes. Use wild cards and filtering to control method trace so that you can focus on the sections of code that interest you.
Method trace can trace:
- Method entry
- Method exit
The methods parameter is defined as:
.-,---------------------------------------------------------. V | >>-methods=--{----[!]--+-*-------------------------+--.--+-*--------------+-+--}->< '-[*][<package>/]<class>[*]-' +-[*]<method>[*]-+ '-[()]-----------'
Where:
- The delimiter between parts of the package name is a forward slash, "/".
- The ! in the methods parameter is a NOT operator that allows you to tell the JVM not to trace the specified method or methods.
- The parentheses, (), define whether or not to include method parameters in the trace.
- If a method specification includes any commas, the whole specification must be enclosed in braces, for example:
-Xtrace:methods={java/lang/*,java/util/*},print=mt- It might be necessary to enclose your command line in quotation marks to prevent the shell intercepting and fragmenting comma-separated command lines, for example:
"-Xtrace:methods={java/lang/*,java/util/*},print=mt"
To output all method trace information to stderr, use:
- -Xtrace:print=mt,methods=*.*
- Print method trace information for all methods to stderr.
- -Xtrace:iprint=mt,methods=*.*
- Print method trace information for all methods to stderr using indentation.
To output method trace information in binary format, see output=<filename>[,sizem[,<generations>]].
Examples
- Tracing entry and exit of all methods in a given class:
-Xtrace:methods={ReaderMain.*,java/lang/String.*},print=mtThis traces all method entry and exit of the ReaderMain class in the default package and the java.lang.String class.- Tracing entry, exit and input parameters of all methods in a class:
-Xtrace:methods=ReaderMain.*(),print=mtThis traces all method entry, exit, and input of the ReaderMain class in the default package.- Tracing all methods in a given package:
-Xtrace:methods=com/ibm/socket/*.*(),print=mtThis traces all method entry, exit, and input of all classes in the package com.ibm.socket.- Multiple method trace:
-Xtrace:methods={Widget.*(),common/*},print=mtThis traces all method entry, exit, and input in the Widget class in the default package and all method entry and exit in the common package.- Using the ! operator
-Xtrace:methods={ArticleUI.*,!ArticleUI.get*},print=mtThis traces all methods in the ArticleUI class in the default package except those beginning with "get".- Tracing a specific method in a class
-Xtrace:print=mt,methods={java/lang/String.substring}This example traces entry and exit of the substring method of the java.lang.String class. If there is more than one method with the same name, they are all traced. You cannot filter method trace by the signature of the method.- Tracing the constructor of a class
-Xtrace:print=mt,methods={java/lang/String.<init>}This example traces entry and exit of the constructors of the java.lang.String class.
Example output
java "-Xtrace:methods={java/lang*.*},iprint=mt" HW 10:02:42.281*0x9e900 mt.4 > java/lang/J9VMInternals.initialize(Ljava/lang/Class;) V Compiled static method 10:02:42.281 0x9e900 mt.4 > java/lang/J9VMInternals.verify(Ljava/lang/Class;) V Compiled static method 10:02:42.281 0x9e900 mt.4 > java/lang/J9VMInternals.verify(Ljava/lang/Class;) V Compiled static method 10:02:42.281 0x9e900 mt.4 > java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.281 0x9e900 mt.10 < java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.281 0x9e900 mt.10 < java/lang/J9VMInternals.verify(Ljava/lang/Class;) V Compiled static method 10:02:42.281 0x9e900 mt.4 > java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.281 0x9e900 mt.10 < java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.281 0x9e900 mt.10 < java/lang/J9VMInternals.verify(Ljava/lang/Class;) V Compiled static method 10:02:42.281 0x9e900 mt.4 > java/lang/J9VMInternals.initialize(Ljava/lang/Class;) V Compiled static method 10:02:42.281 0x9e900 mt.4 > java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.296 0x9e900 mt.10 < java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.296 0x9e900 mt.10 < java/lang/J9VMInternals.initialize(Ljava/lang/Class;) V Compiled static method 10:02:42.296 0x9e900 mt.4 > java/lang/String.<clinit>()V Compiled static method 10:02:42.296 0x9e900 mt.4 > java/lang/J9VMInternals.initialize(Ljava/lang/Class;) V Compiled static method 10:02:42.296 0x9e900 mt.4 > java/lang/J9VMInternals.verify(Ljava/lang/Class;) V Compiled static method 10:02:42.296 0x9e900 mt.4 > java/lang/J9VMInternals.verify(Ljava/lang/Class;) V Compiled static method 10:02:42.296 0x9e900 mt.10 < java/lang/J9VMInternals.verify(Ljava/lang/Class;) V Compiled static method 10:02:42.296 0x9e900 mt.4 > java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.328 0x9e900 mt.10 < java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.328 0x9e900 mt.10 < java/lang/J9VMInternals.verify(Ljava/lang/Class;) V Compiled static method 10:02:42.328 0x9e900 mt.4 > java/lang/J9VMInternals.initialize(Ljava/lang/Class;) V Compiled static method 10:02:42.328 0x9e900 mt.10 < java/lang/J9VMInternals.initialize(Ljava/lang/Class;) V Compiled static method 10:02:42.328 0x9e900 mt.4 > java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.328 0x9e900 mt.10 < java/lang/J9VMInternals.setInitStatus(Ljava/lang/Class;I) V Compiled static method 10:02:42.328 0x9e900 mt.10 < java/lang/J9VMInternals.initialize(Ljava/lang/Class;) V Compiled static methodThe output lines comprise of:
- 0x9e900, the current execenv (execution environment). Because every JVM thread has its own execenv, you can regard execenv as a thread-id. All trace with the same execenv relates to a single thread.
- The individual tracepoint id in the mt component that collects and emits the data.
- The remaining fields show whether a method is being entered (>) or exited (<), followed by details of the method.
Parent: Detailed descriptions of trace options
Error 404 - Not Found Error 404 - Not Found
The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.