Difference between sampling and profiling in jVisualVM

半城伤御伤魂 提交于 2019-11-28 15:11:31

问题


VisualVM has two separate tabs for sampling and profiling. What is the difference between sampling and profiling in VisualVM?


回答1:


Sampling means taking lots of thread dumps and analyzing stack traces. This is usually faster, does not require runtime changes in your bytecode (which may break it), but is also less accurate.

Profiling means instrumenting your classes and methods, so they "report" whenever they are run. This is more accurate, as it counts every invocation of instrumented method, not only those caught when the dump is done. However instrumentation means that the bytecode of your classes is changed, and this may break your program. Actually, for that reason, using profiling on large application servers (like JBoss, or WebLogic) often causes everything to die or hang.



来源:https://stackoverflow.com/questions/12130107/difference-between-sampling-and-profiling-in-jvisualvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!