简体   繁体   English

如何在Java中监视应用程序信息?

[英]How to monitor application information in java?

I'd like to see things like the objects on the heap created by my simple class. 我希望看到类似由我的简单类创建的堆上的对象之类的东西。 However, when I use netbeans profiler to look at my running program, I see thousands of classes, presumably all the good things that java is doing behind the scenes. 但是,当我使用netbeans Profiler来查看正在运行的程序时,我看到了成千上万个类,大概是java在幕后所做的所有美好的事情。

Is there a way in netbeans profiler to drill down to the details of only my thread, and objects that are reachable from my thread? netbeans探查器中是否有一种方法可以深入到仅我的线程的详细信息以及可以从我的线程访问的对象的详细信息? Are there other tools that would be good for that? 还有其他工具对此有好处吗?

I'd like, for example, to be able to see if I'm creating any large, unnecessary objects, how much memory my objects are using up, things like that. 例如,我希望能够查看是否正在创建任何大的,不必要的对象,我的对象正在消耗多少内存,类似的东西。

I'm particularly interested in mac/linux. 我对mac / linux特别感兴趣。

There's a textbox at the bottom where you can filter the classes being inspected. 底部有一个文本框,您可以在其中过滤要检查的类。 There you should write the complete name of your class(es) to inspect. 在那里,您应该写出要检查的班级的全名。

在此处输入图片说明

(Sorry, couldn't find a more exact image, but the same textbox appears in the Memory part) (对不起,找不到更精确的图像,但是在“内存”部分中出现了相同的文本框)


Here's another image where the textbox appears and the text on it is clear: Class Name Filter. 这是出现该文本框且其上的文本清晰的另一张图像:类名过滤器。 Just write complete.nameof.YourClass and it will show the necessary info. 只需编写complete.nameof.YourClass ,它将显示必要的信息。

在此处输入图片说明
(source: java.net ) (来源: java.net

I don't know much about NetBeans Profiler, but I have some other suggestions for tools that I know more about because I work with them.... 我对NetBeans Profiler的了解不多,但是我对一些我所了解的工具有其他建议,因为我与他们合作。

If you should still be using JDK 6, you could use the Memory Leak Analyzer tool from JRockit Mission Control. 如果仍应使用JDK 6,则可以使用JRockit Mission Control中的Memory Leak Analyzer工具。

Otherwise maybe MAT, or Java Flight Recorder (Java Mission Control) 否则可能是MAT或Java Flight Recorder(Java任务控制)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM