Reputation: 4419
I'm using the jvisualvm
to monitor the running java program. when I dig into the details of thread cpu usage, I get the following picture. The CPU usage consists of file portions: Running, Sleeping, Wait, Park and Monitor.
I didn't find any official definition about the columns, so I'd like to know what are these columns really mean in java code.
Running
: time used in executing.Sleeping
: Thread.sleep(long) ?Wait
: ?Park
: LockSupport.park ?Monitor
: ?Upvotes: 1
Views: 1850
Reputation: 14511
Thread.sleep(…)
synchronized
blocks/functions)Upvotes: 0
Reputation: 4419
I made a simple test and found these columns can map to the java code operations:
Thread.sleep(..)
Object.wait(..)
LockSupport.park
.synchronized
method/objectsSo, wait/park/monitor all means the thread is blocked
, but blocked by different reasons.
If a thread is waiting on a socket, the time may be counted on Running
.
In this picture, Thread-pool-Bill is Running
for most of time, but the truth is it is waiting on a socket for a very long time:
"Thread-pool-Bill" - Thread t@42
java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
- locked <79f0aad8> (a java.net.SocksSocketImpl)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
Upvotes: 3