hprof reporting LockSupport.park() taking highest CPU usage

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

hprof reporting LockSupport.park() taking highest CPU usage

Rajesh Balamohan
Hi Folks,

When profiling my application with hprof ("cpu=time" option),I noticed
that LockSupport.park() being reported as the most CPU consuming method.

We have some Linked blocking queues in our application. So I think, its
waiting on take() or so rather than really using the CPU.

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.

Have you folks faced similar situation?. I am using sun JVM 1.5_04.

~Rajesh.B
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: hprof reporting LockSupport.park() taking highest CPU usage

Doug Lea
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


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: hprof reporting LockSupport.park() taking highest CPU usage

Gregg Wonderly-3
In reply to this post by Rajesh Balamohan
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.

The profiler only knows the amount of wall clock time spent underneath a
particular part of the call graph/tree of methods.  It is telling you that most
of the wall clock time is spent at park.  This just indicates the places where
your application is 'waiting' for something to do, and is thus idle time, not
busy time.

Gregg Wonderly

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest