Customizing Net I/O Thread States For CPU Recording
perfino offers you the possibility to record natively sampled CPU data with minimum overhead and stability risk for the entire VM. The resulting snapshot files can be viewed in JProfiler.
One pre-condition for useful sampling data is that all thread states where the thread is waiting are separate from the default "Runnable" thread state. If that is not the case, the top hotspots usually consist of methods that wait, block or perform network input and output (net I/O).
While waiting and blocking are comprehensively handled by the perfino sampling library, network I/O is often performed via native libraries that perfino does not know about. To mitigate this problem, perfino offers a mechanism to specify a list of additional methods that will be considered as net I/O.
To do that, you can specify the system property -Dperfino.netioMethods=[path to text file]
in the Java invocation of the monitored VM. The referenced text file must be located on the machine where the
monitored VM is running. Alternatively, perfino looks for the file
$HOME/.perfino/netio.txt
on Linux/Unix or %USERPROFILE%\.perfino\netio.txt
on
Windows.
In the netio.txt
file, add your net I/O method definitions, one definition per line. A method
definition can have one of three forms:
Class wildcard
Add a class name with a trailing asterisk, like
com.mycorp.MyClass.*
If you reference an inner class, the inner class separators must be written as dollar signs:
com.mycorp.MyClass$InnerClass.*
In this case, all methods of the selected class will be recorded in the net I/O state.
Signature wildcard
Add a class name and a method name, separated by a dot, like
com.mycorp.MyClass.myMethod
In this case, all methods of the selected class with the specified name but with an arbitrary signature will be recorded in the net I/O state.
Specific method
Like "Signature wildcard", but with the signature in bytecode format appended at the end. For example,
java.net.AbstractPlainSocketImpl.doConnect(Ljava/net/InetAddress;II)V
This is an actual net I/O method that is handled by default, the signature is for a method that returns void and takes a
java.net.InetAddress
and twoint
parameters. This is the same format that is used by JNI type signatures.The single specified method will be recorded in the net I/O state as a result of this definition.