What's JProfiler?
JProfiler is a professional tool for analyzing what is going on inside a running JVM. You can use it in development, for quality assurance and for firefighting missions when your production system experiences problems.
JProfiler是一个专业的分析工具,用于分析在运行的JVM。当您的生产系统遇到问题时,您可以在开发、质量保证和消防任务中使用它。
四个主要功能topic
-
Method calls:
This is commonly called "CPU profiling". Method calls can be measured and visualized in different ways. The analysis of method calls helps you to understand what your application is doing and find ways to improve its performance.
“方法调用”通常被称为“CPU 分析”。“方法调用”可以以不同的方式被衡量和可视化。使用“方法调用”分析能帮助你理解应用当前正在做什么,并能帮助找到可优化的地方。 - Allocations:
Analyzing objects on the heap with respect to their allocations, reference chains and garbage collection falls into the category of "memory profiling". This functionality enables you to fix memory leaks, use less memory in general and allocate fewer temporary objects.
分析堆上的对象的分配、引用链和垃圾收集属于“内存分析”的范畴。此功能使您能够修复内存泄漏,一般使用较少的内存,并分配较少的临时对象。 - Thread and locks:
Threads can hold locks, for example by synchronizing on an object. When multiple threads cooperate, deadlocks can occur and JProfiler can visualize them for you. Also, locks can be contended, meaning that threads have to wait before they can acquire them. JProfiler provides insight into threads and their various locking situations.
线程可以保持锁,例如通过对象同步。当多个线程合作时,死锁可能会发生,JProfiler可以为您可视化它们。此外,锁也可以被竞争,这意味着线程必须等待才能获得它们。JProfiler提供了对线程及其各种锁定情况的洞察。 - Higher level subSystem:
Many performance problems occur on a higher semantic level. For example, with JDBC calls, you probably want to find out which SQL statement is the slowest. For subsystems like that, JProfiler offers "probes" that attach specific payloads to the call tree.
“高层子系统”:许多性能问题都发生在较高的语义级别上。例如,JDBC连接,你可能想找到Sql语句执行最慢。对于那样的子系统,JProfiler提供探测的方式,将特殊的负载加到调用树上。
JProfiler安装
- 在IntelliJ IDEA中作为一个插件使用,安装方法如下:
IntelliJ IDEA--->Preferences--->Plugins--->搜索 JProfiler安装,然后重启IntelliJ IDEA即可。
IDEA安装JProfiler插件
通过这种方法可在启动项目的时候看到JVM使用信息,如下, Run with JProfiler
2.在设备上安装JProfiler工具。
官网下载并安装,官网地址
安装成功后,JProfiler就作为一个独立的app存在于设备之上,比如我们可以将 内存溢出的输出文件使用JProfiler打开等等。
另外,也可以在IntelliJ IDEA中设置JProfiler工具的安装路径,我们可以IDEA中直接调用JProfiler这个工具。设置用法如下:
IntelliJ IDEA--->Preferences--->Tools--->JProfiler, 设置JProfiler executable路径。如下,
JProfiler executable
其实JProfiler和Eclipse Memory analyzer的用处一样,都是为了分析JVM使用情况而生。
网友评论