如何获取 JConsole 中显示的 VM 信息?
启动JConsole,选择一个进程,然后进入VM Summary,可以看到很多VM信息,例如:
- 活动线程数
- 当前加载的类数
- 编译时间
- 当前堆大小
- 启动的线程总数
我可以在 Java 应用程序中访问该信息吗?如果是这样,怎么办?
更新: 这是一个图像 http://download.oracle .com/javase/1.5.0/docs/guide/management/images/summarytab.jpg
Starting JConsole, selecing a process and then and heading over to VM Summary, one can see a lot of VM information, such as:
- Number of live threads
- Number of current classes loaded
- Compilation time
- Current heap size
- Total threads started
Is there I can access that information inside a Java application? If so, how?
Update:
Here is an image http://download.oracle.com/javase/1.5.0/docs/guide/management/images/summarytab.jpg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个野兽的名字是“Java管理扩展(JMX)”。
以下是 Oracle 的“入门”概述。您必须实现 JMX 管理器来从 JVM 或其他检测的应用程序读取已发布的内部结构。
The name of the beast is "Java Management Extension (JMX)".
Here is a "Getting Started" overview from oracle. You'll have to implement a JMX Manager to read the published internals from the JVM or from other instrumented applications.
http://www.java2s.com/Code/Java/Development-Class /ExampleofusingthejavalangmanagementAPItosortthreadsbyCPUusage.htm
享受
http://www.java2s.com/Code/Java/Development-Class/ExampleofusingthejavalangmanagementAPItosortthreadsbyCPUusage.htm
enjoy