问题描述
VisualVM有两个单独的选项卡用于采样和分析。有人可以帮我弄清楚VisualVM中的采样和分析之间的区别吗?
VisualVM has two separate tabs for sampling and profiling. Can someone help me figure out the difference between sampling and profiling in VisualVM ?
推荐答案
采样
表示需要进行大量的线程转储并分析堆栈跟踪。
这通常更快,不需要在字节码中更改运行时(这可能会破坏它),但也不太准确。
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.
分析
表示您的类和方法,因此无论何时运行它们都会报告。这更准确,因为它计算每次调用检测方法的次数,而不仅仅是在转储完成时捕获的那些。但是,检测意味着更改了类的字节码,这可能会破坏您的程序。实际上,出于这个原因,在大型应用程序服务器(如JBoss或WebLogic)上使用分析通常会导致所有内容死亡或挂起。
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.
这篇关于jVisualvm中的采样和分析之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!