Söz dizimi şöyle
java -agentlib:hprof[=options] ToBeProfiledClass
java -Xrunprof[:options] ToBeProfiledClass
javac -J-agentlib:hprof[=options] ToBeProfiledClass
Options için açıklama şöyle
Option Name and Value Description Default--------------------- ----------- -------heap=dump|sites|all heap profiling allcpu=samples|times|old CPU usage offmonitor=y|n monitor contention nformat=a|b text(txt) or binary output afile=<file> write data to file java.hprof[.txt]net=<host>:<port> send data over a socket offdepth=<size> stack trace depth 4interval=<ms> sample interval in ms 10cutoff=<value> output cutoff point 0.0001lineno=y|n line number in traces? ythread=y|n thread in traces? ndoe=y|n dump on exit? ymsa=y|n Solaris micro state accounting nforce=y|n force output to <file> yverbose=y|n print messages about dumps y
cpu seçeneği
Örnek - samples
java -agentlib:hprof=cpu=samples,interval=20,depth=20 -jar target.jar
Örnek - samples
java -agentlib:hprof=cpu=samples,interval=20,depth=3 Hello
Açıklaması şöyle
The CPU consumption information is sampled every 20 milliseconds, the stack depth is 3, and the name of the generated profile file is java.hprof.txt, which is in the current directory.
Örnek - times
javac -J-agentlib:hprof=cpu=times Hello.java
Açıklaması şöyle
An example of CPU Usage Times Profiling (cpu=times), which can obtain more fine-grained CPU consumption information than CPU Usage Sampling Profile, and can be detailed to the beginning and end of each method call. Its implementation uses bytecode injection Technology (BCI):
heap seçeneği
Örnek - sites
javac -J-agentlib:hprof=heap=sites Hello.java
Açıklaması şöyle
Example of Heap Allocation Profiling (heap=sites):
Açıklaması şöyle
Although the -Xrunprof:heap=sites parameter can be added to the JVM startup parameters to generate the CPU/Heap Profile file, but it has a great impact on the performance of the JVM, and it is not recommended to use it in an online server environment.
Örnek - dump
javac -J-agentlib:hprof=heap=dump Hello.java
Açıklaması şöyle
An example of Heap Dump(heap=dump), which can generate more detailed Heap Dump information than the above Heap Allocation Profiling:
Hiç yorum yok:
Yorum Gönder