监视应用程序线程

VisualVM 在特定于该应用程序的选项卡中显示本地和远程应用程序的数据。应用程序选项卡显示在 "应用程序" 窗口右侧的主窗口中。一次可以打开多个应用程序选项卡。每个应用程序选项卡都包含显示有关应用程序的不同类型信息的子选项卡。

Monitoring Thread Activity

VisualVM 在 "线程" 选项卡中显示有关线程活动的实时高级别数据。
注意: "线程" 选项卡中显示的信息基于 Java 管理扩展 (JMX)。如果 VisualVM 可以使用目标应用程序制作基于 jmx 技术的连接 (jmx 连接) 并从 JVM 软件中检索 jmx 检测, 则 "线程" 选项卡是可见的。如果目标应用程序是在 Java 开发工具包 (JDK) 版本1.6 上运行的本地应用程序, 则会自动生成 JMX 连接。如果目标应用程序未在 JDK 1.6 版上运行, 则可能需要显式建立与 JVM 软件实例的 JMX 连接。有关建立 JMX 连接更多内容, 请参见以下文档:

By default the Threads tab displays a timeline of current thread activity. You can click a thread in the timeline to view details about that thread in the Details tab.

Timeline Tab

此选项卡显示具有实时线程状态的时间线。使用时间轴工具栏中的按钮可以放大/缩小当前视图, 并切换到缩放以适应模式。下拉列表使您可以选择显示哪些线程。您可以选择查看所有线程、实时线程或已完成的线程。还可以选择单个线程或多个线程来显示线程的子集。在 "详细信息" 选项卡中, 可以双击线程时间线以打开该线程。

每个线程的时间线提供了线程活动的快速概述。

[译] 06-Monitoring Application Threads

Details Tab

The Details tab displays more detailed information about individual threads. Using the drop-down list, you can select to display all threads, all live threads or all finished threads. You can also choose to display only the details of threads selected in the Timeline view. For each thread, the name, classname and current status (alive/finished) are displayed. A short description of the thread is also provided.

Each thread displayed in the Details tab has the following tabs:

  • General. This tab displays thread states statistics.
  • Details. This tab contains full listings of thread states with timestamps.

A timeline for each thread provides a quick overview of the thread's activity.

[译] 06-Monitoring Application Threads

Taking a Thread Dump

在本地应用程序运行时, 可以使用 VisualVM 来执行线程Dump (堆栈跟踪)。采用线程Dump不会停止应用程序。打印线程Dump时, 您会得到包含 Java 线程的线程状态的线程堆栈的打印输出。
在 VisualVM 中打印线程Dump时, 该工具将打印应用程序活动线程的堆栈跟踪。在没有应用程序的命令行控制台的情况下, 使用 VisualVM 进行线程转储可能非常方便。可以使用堆栈跟踪来帮助诊断许多问题, 如死锁或应用程序挂起。
线程Dump子选项卡中的线程转储 (堆栈跟踪) 的截图。

[译] 06-Monitoring Application Threads

Return to the VisualVM Documentation index

相关文章:

  • 2022-01-23
  • 2021-12-23
  • 2021-07-07
  • 2021-07-18
  • 2022-12-23
  • 2021-09-07
  • 2021-10-05
猜你喜欢
  • 2022-12-23
  • 2021-08-12
  • 2021-11-11
  • 2021-10-04
  • 2021-04-15
  • 2021-12-02
  • 2021-06-10
相关资源
相似解决方案