在分析的背景下,什么是安全点和安全点轮询? [英] What are safe points and safe point polling in context of profiling?

查看:262
本文介绍了在分析的背景下,什么是安全点和安全点轮询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的情况是,我没有看到 VisualVM 应用程序记录某些方法调用。想找出原因并遇到这个回答问题。第三点提到了 sampling 方法的潜在问题(这是我看到的唯一选项,可能是因为我正在进行远程分析)。它提到代码中的安全点和代码本身的安全点轮询。这些术语意味着什么?

I am facing a situation where I do not see some method calls not being recorded by the VisualVM application. Wanted to find out the reason and came across this answer on SO. The third point mentions about a potential issue of the sampling method(which is the only option that I am seeing enabled probably because I am doing remote profiling). It mentions about safe points in code and safe point polling by code itself. What do these terms mean?

推荐答案

Java采样分析器工具的不准确性及其与安全点的关系问题非常好在评估Java Profilers的准确性(PLDI'10)中讨论。

The issue of inaccuracy of Java sampling profiler tools and its relation to the safe points is very well discussed in Evaluating the Accuracy of Java Profilers (PLDI'10).

基本上,由于在安全点期间发生采样这一事实,Java分析器在采样时可能会产生不准确的结果。由于编译器可以修改安全点的出现,因此探测器可能永远不会通过采样执行某些方法。因此,分析器计划记录代码的样本(时间间隔为up),但它必须等待安全点的出现。并且因为安全点是例如由编译器移动,从未观察到理想采样的方法。

Essentially, Java profilers may produce inaccurate results when sampling due to the fact that the sampling occurs during the safe points. And since occurrence of safe-points can be modified by the compiler, execution of some methods may never by sampled by the profiler. Therefore, the profiler is scheduled to record a sample of the code (the time interval is up) but it must wait for the occurrence of the safe-point. And since the safe-point is e.g. moved around by the compiler, the method that would be ideally sampled is never observed.

正如之前的anwer所解释的,安全点是代码中的事件或位置,编译器中断执行以执行某些内部VM代码(例如GC) )

As already explained by the previous anwer, a safepoint is an event or a position in the code where compiler interrupts execution in order to execute some internal VM code (for example GC).

安全点轮询是一种实现安全点或安全点触发器的方法。这意味着在正在执行的代码中,您定期检查一个标志以查看是否需要安全点执行,如果是(由于例如GC触发),则线程被中断并且执行安全点。参见例如 GC安全点(或安全点)和安全区域

The safe-point polling is a method of implementing the safepoint or a safepoint trigger. It means that in the code being executed you regularly check a flag to see if a safe-point execution is required, if yes (due to e.g. GC trigger), the thread is interrupted and the safepoint is executed. See e.g. GC safe-point (or safepoint) and safe-region

这篇关于在分析的背景下,什么是安全点和安全点轮询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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