s
WAS generated files: javacore.***.txt, heapdump.***.phd, core.***.dmp, Snap.***.trc
What are the common files generated by WAS?
Original link: http://blog.csdn.net/pqh20085101092/article/details/39370389
javacore.***.txt : Regarding the cpu, the javacore file is a snapshot of the java process. It mainly saves the running position of each thread of the Java application at a certain moment, that is, which class, which method, which method is executed by the JVM on one line. That is, the threaddump file.
1. Download ThreadDumpAnalyser, graphviz, svgviewer
ThreadDumpAnalyser:
https://www.ibm.com/developerworks/mydeveloperworks/groups/service/html/communityview?communityUuid=2245aa39-fa5c-4475-b891-14c205f7333c
2. Run runall .bat javacore.txt, will generate three files dumps.xml, locktree1.svg, sidebyside.html
two. View heapdump file
1. Download ha433 package from IBM website, release, execute ha433.jar file
IBM HeapAnalyzer:
https://www.ibm.com/developerworks/mydeveloperworks/groups/service/html/communityview?communityUuid=4544bafe-c7a2- 455f-9d43-eb866ea60091
2. Open heapdump.phd in the ha433 window, from which the analysis results will be displayed
进入wsadmin
D:\IBM\WebSphere\AppServer\bin>wsadmin -user wasadmin -password password
1. Generate javacore file and
set jvm environment variables:
wsadmin>set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]
Generate javacore file:
wsadmin>$AdminControl invoke $jvm dumpThreads
to find JVM object name:
wsadmin>set objectName [$AdminControl queryNames WebSphere:type=JVM,process=server1,*]
Generate heapdump file:
wsadmin> $AdminControl invoke $objectName generateHeapDump
How to view the Snap.***.trc file generated by WAS
When the WAS heapdump occurs, the javacore and Snap.***.trc files are also generated.
The Snap.***.trc file cannot be viewed directly and needs to be formatted. Even if it is opened with a text editor, there are still many garbled characters.
The trace formatter is a Java program that can run on any platform and can format trace files from any platform.
IBM SDK 在 core.jar 中提供了这个格式化器,它还需要一个称为 TraceFormat.dat 的文件,其中包含格式化模板。这个文件在 jre/lib 中。
可以用以下命令行启动跟踪格式化器:
- <span style="font-size:14px;">java com.ibm.jvm.format.TraceFormat input_file [output_file]</span>
在这里,com.ibm.jvm.format.TraceFormat 是跟踪格式化器类,input_file 是要进行格式化的二进制跟踪文件的名称,output_file 是可选的输出文件名。如果没有指定输出文件,那么默认的输出文件名是输入文件名加上 .fmt。
IBM的dw网站有详细的说明:http://www.ibm.com/developerworks/cn/java/j-ibmjava5/index.html
具体实例命令如下:
- C:\Users\Administrator>cd D:\WebSphere\AppServer\java\bin
- C:\Users\Administrator>d:
- D:\WebSphere\AppServer\java\bin>java com.ibm.jvm.format.TraceFormat D:\WebSphere\AppServer\profiles\AppSrv04\Snap.20150709.143231.10516.0001.trc
- *** Starting data extraction from binary trace file(s)
- *** Locating formatting template files
- *** Found D:\WebSphere\AppServer\java\jre\lib\J9TraceFormat.dat
- *** Found D:\WebSphere\AppServer\java\jre\lib\TraceFormat.dat
- *** Loading further formatting templates from D:\WebSphere\AppServer\java\jre\lib\TraceFormat.dat
- *** Extracting 89 buffers from D:\WebSphere\AppServer\profiles\AppSrv04\Snap.20150709.143231.10516.0001.trc
- *** Sorting buffers
- *** Starting formatting of entries into text file D:\WebSphere\AppServer\profiles\AppSrv04\Snap.20150709.143231.10516.0001.trc.fmt
- *** Number of traced threads = 89
- 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
- *** Number of formatted tracepoints = 17114
- *** Formatting complete
- *** Formatted output written to file: D:\WebSphere\AppServer\profiles\AppSrv04\Snap.20150709.143231.10516.0001.trc.fmt
- 0 errors were detected during formatting
- D:\WebSphere\AppServer\java\bin>
Snap.***.trc文件格式化之后就可以使用文本编辑器查看了
参考资料:http://bbs.landingbj.com/t-0-177321-1.html
linux was trc文件生成fmt方法,root用户调用命令
[root@Loadrunner19 ~]# /opt/IBM/WebSphere/AppServer/java/bin/java com.ibm.jvm.format.TraceFormat /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/Snap.20160822.154449.11135.0003.trc /opt/test.fmt
end