[concurrency-interest] hprof reporting LockSupport.park() taking highest CPU usage

Doug Lea dl at cs.oswego.edu
Wed Sep 6 11:23:44 EDT 2006


Rajesh Balamohan wrote:
> 
> What I am wondering is, whether the JVM is internally spinning on the CPU
> rather than really waiting. Probably that is making this method to crop up
> to the top of the list. If so, I guess I need to look for a parameter
> which can disable that option so that the CPU cycle can be used for some
> other work rather than spinning.
> 

There is not much spinning in most j.u.c classes, including
LinkedBlockingQueue.

My offhand guess is that profiling tools have a hard time accurately
reporting CPU times as threads become blocked and unblocked.

Usually, the best tools for evaluating such things are visual.
If you are running on unix, get a copy of perfbar
   http://gee.cs.oswego.edu/dl/code/
and watch how much time is spent in system-calls (red) which in
this case will reflect block/unblock context-switch times.

-Doug




More information about the Concurrency-interest mailing list