如何在 Eclipse Profiler 中显示 java.lang.* 对象分配?
使用 Eclipse 分析器,我对 java.lang 中分配的类实例的数量(例如 String
)感兴趣。我还想知道诸如对 String.equals()
的调用次数等信息。
我使用“对象分配”选项卡,显示应用程序中的所有类和计数,但有 没有提及任何标准 java 类。
例如,这个愚蠢的代码在“对象分配”选项卡中显示为 1000 Foo
, 7 byte[]
, <代码>4 char[] 和2 int[]
。没有别的了。
public static void main(String[] args)
{
Object obj[] = new Object[1000];
for (int i = 0; i < 1000; i++) {
new Foo(); // Some custom class
obj[i] = new StringBuffer("foo" + i);
}
System.out.println (obj[30]);
}
分析器似乎只是忽略了 java.* 包中的所有内容。这同样适用于执行统计信息。
我是否需要为核心 java 类启用检测,或者我是否缺少一些设置?
Using the Eclipse profiler, I am interested in number of allocated instances of classes from java.lang (for instance String
). I also want to know stuff like number of calls to String.equals()
etc.
I use the "Object Allocations" tab and I shows all classes in my application and a count, but there is no mention of any standard java classes.
For instance, this silly code shows up in the Object Allocations tab as 1000 Foo
, 7 byte[]
, 4 char[]
and 2 int[]
. Nothing else.
public static void main(String[] args)
{
Object obj[] = new Object[1000];
for (int i = 0; i < 1000; i++) {
new Foo(); // Some custom class
obj[i] = new StringBuffer("foo" + i);
}
System.out.println (obj[30]);
}
It seems the profiler simply ignores everything that is in any of the java.* packages. The same applies to Execution Statistics as well.
Do I need to enable instrumentation for the core java classes or is there some setting I am missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用此处列出的相同 Eclipse 分析器,则需要设置包含/排除过滤器向上。根据您的情况,您可以将特定的包或类添加到包含过滤器中,或者只是将其从预定义的排除过滤器中删除。我会选择前者,因为它是更保守的方法,并且很可能对您的应用程序性能产生较小的影响。从排除过滤器中删除某些内容可能会导致删除的内容超出您的预期或想要的内容,这意味着会检测更多代码。
If you're using the same Eclipse profiler listed here you need to set the inclusion/exclusion filters up. In your case, you can add a particular package or class to the inclusion filter, or simply remove it from the exclusion filter pre-defined. I would go with the former as its the more conservative approach and will most likely have a lower impact on your application performance. Removing something from the exclusion filter may result it removing more than you intended or wanted, meaning that more code is instrumented.