寻找端到端Java CPU Profilers的建议 [英] Looking for recommendations for end-to-end Java CPU Profilers

查看:101
本文介绍了寻找端到端Java CPU Profilers的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java存在哪些优秀的端到端CPU分析器?



我正在寻找的快速列表:


  1. 离线分析 - 程序执行期间无需用户交互或GUI。将配置文件数据转储到文件然后需要使用GUI进行查看很好,我只是不想在工作运行时保管它。

  2. 端到端记录 - Profiler应该能够在进入J2SE应用程序的主调用后立即开始录制。它应该在JVM退出之前立即停止记录。

  3. 调用图生成 - 在分析之后,将数据转换为可视调用图很好。

Google有一个很好的C / C ++剖析器 - http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html



如果存在Java的等价物,它正是我正在寻找的。

我没有在我的潜在剖析器列表中包含HProf,因为它表现不佳与我使用精确CPU调用分析时看到的其他商业分析器相比(通常通过字节代码注入完成,这很慢,但HProf比其他分析器至少慢一个数量级,并且当单个采样配置文件运行时需要1-2个小时,相同的运行等待超过一天是不可接受的)

解决方案

到目前为止,我最喜欢的是 JProfiler 。我直到现在才意识到这一点(因为我总是使用交互式分析GUI),但它实际上支持离线分析,就像你描述的那样。



A其他一些很酷的功能:




  • 它描述了所有的SQL语句,因此您可以看到哪些数据库查询正在减慢您的速度。


  • 它跟踪哪些方法(在哪个类和包中)分配最多的内存,哪些类型的对象&数组,以及这些对象的寿命。因此,如果你正在泄漏内存,那么很容易找到哪些类型的类实例比它们的实用性更长,并找到最初分配这些对象的方法(以及谁持有保持对象存活的引用)。 / p>


  • 您可以跟踪虚拟机增长情况,监控GC完整集合的频率,并确定在每个收集周期中释放的对象数量(类型) 。


  • 当然,您可以获得所有方法调用的分层细分,包括调用次数和平均执行时间(独占或包含)调用堆栈。您还可以从最差瓶颈函数的角度查看此层次结构,按执行时间或内存分配排序。




<对我来说,JProfiler是我开发过程中最重要的工具之一(仅次于Eclipse)。






另外:免费试用10天。下载并查看。而且,顺便说一下,我不是公司或任何东西的附属品。在过去的五六年里,我只是一个满意的客户。


What are some good end to end CPU profilers that exist for Java?

Quick list of things I'm looking for:

  1. Offline profiling - No user interaction or GUI required during program execution. Dumping the profile data to a file and then requiring viewing afterwards with a GUI is fine, I just don't want to have to babysit it as the job runs
  2. End to End recording - Profiler should be able to start recording immediately after entering the main call for a J2SE application. It should stop recording immediately before the JVM exits.
  3. Call graph generation - After profiling, it'd be nice to turn the data into a visual call graph.

Google has a nice profiler for C/C++ - http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html

If the Java equivalent of this exists, it'd be exactly what I'm looking for.

I'm not including HProf in my list of prospective profilers because it performs badly compared to other commercial profilers I've looked at when you use accurate CPU call profiling (Usually done via Byte Code Injection, which is slow, but HProf appears at least an order of magnitude slower than other profilers, and when a single sampling profile run takes 1-2 hours, waiting more than a day for the same run is unacceptable)

解决方案

My favorite, by far, is JProfiler. I didn't realize it until just now (because I always use the interactive profiling GUI), but it does in fact support offline profiling, exactly like you described.

A few other cool features:

  • It profiles all your SQL statements, so you can see which DB queries are slowing you down.

  • It keeps track of which methods (in which classes & packages) are allocating the most memory, for which types of objects & arrays, and the longevity of those objects. So, if you're leaking memory, it's easy to track down which types of class instances are outliving their usefullness, and to find the methods where those objects were originally allocated (and who's holding the references that are keeping the objects alive).

  • You can keep track of the VM growth, monitoring the frequency of GC full collections, and determining how many objects (of which type) were freed during each collection cycle.

  • And of course, you get a hierarchical breakdown of all method invocations, with the number of calls and mean execution time (exclusive or inclusive) of the whole call stack. You can also view this hierarchy from the perspective of "worst bottleneck" functions, ordered either by execution time or memory allocation.

For me, JProfiler is one of the most important tools in my development process (second only to Eclipse).


Also: there's a free 10-day trial. Download it and check it out. And, btw, I'm not affiliated with the company or anything. I've just been a happy customer for the last five or six years.

这篇关于寻找端到端Java CPU Profilers的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆