Description: The Threads tab allows you to monitor thread activity. This tab contains a graph that plots live thread usage by the application over time, a table with all live threads used by the application, and stack traces for selected threads.

Go to primary content

| Previous | Next |

# Using the Threads Tab

The Threads tab allows you to monitor thread activity. This tab contains a graph that plots live thread usage by the application over time, a table with all live threads used by the application, and stack traces for selected threads.

Live Thread Graph

The Live Thread Graph show the number of threads started by the Java application over time. By default, the following attributes are displayed in the graph:

- Daemon Live Thread Count: The number of daemon live threads.

- Peak Live Thread Count: The number of peak live threads.

- Total Live Thread Count: The total number of live threads.

For information about adding and removing attributes for a graph, see Working with Attributes. For information about using graphs, see Working with Graphs.

Live Threads

The Live Threads panel contains a table with information about live threads started by the Java application. By default, the table contains the following columns:

- Thread Name: The name of the thread.

- Thread State: The state of the thread. A thread can be in one of the following states: `NEW`, `RUNNABLE`, `BLOCKED`, `WAITING`, `TIMED_WAITING`, or `TERMINATED`.

- Blocked Count: The number of times that the thread was in the `BLOCKED` state.

- Total CPU Usage: The percentage of the total CPU resources used by the thread. This value is not fetched by default. To enable it, select CPU Profiling above the table.

- Deadlocked: Whether the thread is deadlocked. This value is not fetched by default. To enable it, select Deadlock Detection above the table.

- Allocated Memory: The amount of memory allocated to the thread. This value is not fetched by default. To enable it, select Allocation above the table.

Monitoring the last three values in real time consumes a lot of system resources. This is why they are disabled by default. Use the corresponding check boxes above the table, to enable monitoring of these values.

To filter the thread in the table, select the filter column (usually, the thread name) and specify the filter string in the text field above the table.

To configure the appearance of the table, right-click a Thread Name in the Live Threads panel, choose Visible Columns, and select the columns that you want to show or hide. In addition to the default columns, you can add the following:

- Blocked Time: The accumulated time (in milliseconds) that the thread was in the `BLOCKED` state.

- Lock Name: The locked object that this thread is trying to access, or the object that called wait() when this thread was the current thread.

- Lock Owner ID: The identifier of the thread that locked the object this thread is trying to access.

- Lock Owner Name: The name of the thread that locked the object this thread is trying to access.

- Thread ID: The identifier of the thread.

- Waited Count: The number of times that the thread was in the `WAITING` or `TIMED_WAITING` state.

- Waited Time: The accumulated time (in milliseconds) that the thread was in the `WAITING` or `TIMED_WAITING` state.

- Native: Whether the thread is currently executing native code using the Java Native Interface (JNI).

- Suspended: Whether the thread is suspended.

Stack Traces for Selected Threads

When you select a thread in the Live Threads table, its full stack trace is displayed in the Stack traces for selected threads panel below. The stack trace contains the call path for all methods up to the one that is currently executed. It is useful, for example, when you need to identify the method that led to a deadlock or unexpected halt in code execution.

You can select several threads in the Live Threads table using the Control key to display multiple stack traces.

Copyright © 2018, 2022, Oracle and/or its affiliates. All rights reserved. | Previous | Next |