Running the profiler
Prerequisites
If you have not yet downloaded or installed patty, follow the instructions here.
Options for the profiler
With the above files installed, let's give the whole installation a start run.
There are various options you can pass to the agent, which are explained below. For now, specify the following command line to start any Java application of your liking, which should send performance data to the performance dumper successfully. The following command should be specified on a single line in the shell or command window:
java -Xbootclasspath/a:Pat.jar -agentlib:pat=host=localhost,port=5005,controlport=5004,contention=y,coverage=y com.blogspot.radialmind.Main
- host: Points to the host that runs the performance dumper.
- port: Points to the port on the specified host where the performance dumper is listening.
- controlport: This will open a port on the agent library, where it receives commands from the drill application. Used to instruct the agent to instrument/deinstrument, etcetera.
- contention: If set to 'y', instructs the agent to analyse thread contention. All other settings assume no.
- coverage: If set to 'y', instructs the agent to include code coverage analysis. All other settings assume no.
- include: Specifies a file with (fragments of) package names or fully qualified classnames on each line to include. All others not complying with the format are excluded.
- exclude: Specifies a file with (fragments of) package names or fully qualified classnames on each line to exclude. If include is also specified, this may exclude certain classes or packages that are to be excluded from that collection.
- garbage: If set to 'y', instructs the agent to include garbage collection analysis.
Example contents for the include/exclude files. It uses part of the standard "JNI" signature. Notice there is no "L" at the start (normally present in JNI signatures), neither a ";" at the end. It uses slashes instead of dots for path separators. There is currently no wildcard support. You can specify any start of a path, or full path to a class file. Do not include ".java" or ".class" at the end in that case! It is not possible to exclude classes by only including the classname, for example "InputStream" does not exclude/include all classes on any path that are called "InputStream". The full path to classes is required.
com/blogspot/otherpath/ <== full package and subpackages com/blogspot/p <== parts of a package ( everything starting with p ) com/blogspot/radialmind/MyThread <== fully qualified class name
Classes that are instrumented at the moment are all classes that are not in the "java/" or "sun/" packages. Every other class will be instrumented, as long as it is included through the "include" parameter and not excluded by the "exclude" parameter.
The decision was made that if the developer really wishes to profile a Java class or "sun" class, this can be turned on per class by clicking on the required class file in the web GUI.