java jVisualVM 中采样和分析的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12130107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 07:42:31  来源:igfitidea点击:

Difference between sampling and profiling in jVisualVM

javajvmheapjvisualvm

提问by Parag

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

VisualVM 有两个单独的选项卡用于采样和分析。VisualVM 中的采样和分析之间有什么区别?

回答by npe

Samplingmeans 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.

Sampling意味着进行大量线程转储并分析堆栈跟踪。这通常更快,不需要在您的字节码中进行运行时更改(这可能会破坏它),但也不太准确。

Profilingmeans instrumentingyour 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.

Profiling意味着检测您的类和方法,因此它们在运行时“报告”。这更准确,因为它计算对检测方法的每次调用,而不仅仅是在转储完成时捕获的调用。然而,检测意味着您的类的字节码已更改,这可能会破坏您的程序。实际上,出于这个原因,在大型应用程序服务器(如 JBoss 或 WebLogic)上使用分析通常会导致一切死机或挂起。