Discovering Tenured Threshold programmatically

Philipp Stiegler gateway at gateways-home.org
Fri Feb 3 13:40:03 PST 2012


Hi Kris,

perfectly, thats the API I was searching for.
Big load of thanks!

All the best!
Philipp

On 2012-02-03 03:58, Krystal Mok wrote:
> Hi Philipp,
>
> I'm not aware of any means of getting the current tenuring threshold 
> via JMX as of now.
>
> But it's available through another API, namely the HSPERFDATA (or 
> jvmstat) API. If that doesn't sound familiar to you, the stats you see 
> from jstat or Visual GC actually come from this API.
>
> Try this from command line:
>
> jstat -J-Djstat.showUnsupported=true -snap <pid> | grep 
> 'sun.gc.policy.tenuringThreshold'
>
> This will give you the current tenuring threshold, and
>
> jstat -J-Djstat.showUnsupported=true -snap <pid> | grep 
> 'sun.gc.policy.maxTenuringThreshold'
>
> this will give you the max tenuring threshold.
>
> I've written an example of getting data from HSPERFDATA 
> programmatically some time ago [1]. The blog is in Chinese, but the 
> code example should give you enough hint. And there's another example 
> of using the -snap parameter with jstat [2].
>
> Hope this helps,
> - Kris
>
> [1]: http://rednaxelafx.iteye.com/blog/790864
> [2]: http://rednaxelafx.iteye.com/blog/796343
>
> On Fri, Feb 3, 2012 at 3:55 AM, Philipp Stiegler 
> <gateway at gateways-home.org <mailto:gateway at gateways-home.org>> wrote:
>
>     Hello Guys,
>
>     I tried to write my own monitoring tool to create dynamically views
>     based on command line parameters.
>     If someone needs the code for verification you find the source here:
>     http://www.gateways-home.org/wb/media/jperfmon/jperfmon.zip
>
>     My problem now is, that I also want to log the tenured threshold. I
>     searched quite a while, but I didn´t find a way for getting this value
>     from the jvm.
>     Basically I connect to the vm via com.sun.tools.attach.VirtualMachine
>     and I read the values out of the MBean structure (e.g.
>     MemoryMXBean) but
>     I don´t find this threshold in there.
>     Maybe someone can help me out?
>
>     Many thanks in advance!
>
>     All the best!
>
>     Philipp Stiegler
>     _______________________________________________
>     hotspot-gc-use mailing list
>     hotspot-gc-use at openjdk.java.net
>     <mailto:hotspot-gc-use at openjdk.java.net>
>     http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20120203/5a1e377b/attachment.html 


More information about the hotspot-gc-use mailing list