YourKit Java Profiler 9.5.1 分析思考一

[size=medium]
以下是我对使用YoutKit 对程序分析的一些想法!
[b]程序分析思路[/b]
[b]分析CPU[/b]得到应用程序中某个类中的方法被调用的次数及其CPU处理花费时间。
操作方式[img]http://dl.iteye.com/upload/picture/pic/77771/1e1734fc-73f7-3869-8575-ddde6fff888b.jpg[/img][img]http://dl.iteye.com/upload/picture/pic/77773/21cee841-0b8f-3f36-9c86-06eb04811cde.jpg[/img]
• Start or Stop CPU评估(profiling)(1)
• 清除CPU之前的评估结果并且继续评估(2)
• 保存此时的评估快照(Snapshots)(3)
评估方式(profiling):
• Sampling(不包含方法调用,只含有CPU time)
• Tracing(包含方法调用和CPU time)
分析参数:(主要从调用方法次数和调用时间来分析)
• Calltree(all threads together)
• Calltree(by thread)
• Hotspots
• Methods list
[color=red]
总结:
1. 通过CPU Profile我们了解类、方法使用CPU处理的时间以及被调用的次数。
2. 通过CallTree了解调用的关系。通过Hotspots显示哪些包下的方法使用CPU处理的时间长及其被调用的次数。
3. 重点分析CPU处理时间长同时调用的次数比较少的类、方法。或主观认为CPU处理时间应该很短而显示CPU处理时间长;主观认为调用的次数少而显示调用次数很多的类或者方法,进行重点分析。(不一定有问题。但是必须要去看看。)[/color]
[b]分析Memory[/b]
操作方式 [img]http://dl.iteye.com/upload/picture/pic/77775/9c6d114d-1d16-330a-aaf6-1da0d8dec8bd.jpg[/img]
• Capture memory snapshot (1)
• Start/stop object allocation recording (2)
• Advance object generation number(3)
• Edit triggers(4)
内存保留方式:
• Shallow Size
• Retained Size
分析参数:
• Class list
o 显示类对象分配的内存
• Biggest Objects(domainators)
o 显示占有内存的单个对象
• Generations
o 显示在某个时间段中产生的单个对象
• Reachability scopes:显示GC与对象的关系(强对象,软对象,弱对象,虚引用)
o Objects unreachable from GC roots, but not yet collected
o Objects reachable from GC roots via strong references
o Objects reachable from GC roots via weak and/or soft references only
o Objects pending finalization(Objects in the finalizer queue)
• Class loaders
o 按类加载的顺序显示加载的类
• Inspections
通过 [img]http://dl.iteye.com/upload/picture/pic/77777/05edc06e-29d2-3b6c-af56-4f367a1eef37.jpg[/img]
进行分析。分析显示的参数请参考参数详解中的Inspections
[color=red]总结:
1. 通过Memory Profile我们了解类对象的具体存储及其类的加载方式、顺序。
2. 通过Memory 的Class List中可以查询出开发者直接编写的Class。分析编写的Class的对象及其占有的内存的大小。
3. 同时要想更好的了解Class对象的信息。请选择要查询的Class单击左键可以看见[img]http://dl.iteye.com/upload/picture/pic/77779/d9857203-151f-3c8e-8a26-bf7ad80ac1d2.jpg[/img] 。使用Path from GC Roots 、instances by Class 、Selected Objects、Retained Object进行查看你想了解的信息。可以通过集成IDE来关联到源码。选择Open Declaration in IDE Editor
4. 结合Class List 和Biggest Objects来进行分析:注意是否存在类占有很大内存和很大对象而与实际编写源码不相符。
5. 分析Inspections中给出的提示。[/color]

[b]分析GC(Garbage Collection)[/b]
操作方式 [img]http://dl.iteye.com/upload/picture/pic/77781/a4177cf9-6e31-3d6c-9411-acd0a939f00c.jpg[/img]
• 先操作(1)再操作(2)
分析参数
• Call tree(all threads together)
• Calltree(by thread)
• Hot spots by object count
• Hot spots by object size
• Method list
[color=red]总结:
1. GC操作比较频繁的类对象。是值得去注意的。因为该类可能产生了大量的临时对象。导致GC频繁操作。[/color]
[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值