Review Request for 6878481: Add performance counters in the JDK

Andrew John Hughes gnu_andrew at
Thu Sep 3 17:34:18 UTC 2009

2009/9/3 Mandy Chung <Mandy.Chung at>:
> Alan Bateman wrote:
>> Andrew John Hughes wrote:
>>> :
>>> The use of synchronized at present seems flawed as only the set
>>> methods are protected and not the get.  So lb.get could be called
>>> while in an lb.put call.  I don't see the reason for using a
>>> LongBuffer either, as only index 0 is ever used.  Why not use an
>>> AtomicLong?
>> The LongBuffer is a direct buffer with a reference to memory in the
>> PerfData instrumentation buffer. This is the shared memory that jvmstat
>> clients (jstat, VisualVM , ..) will attach to in order to monitor the VM.
> I can add synchronized in the get method.  The PerfData instrumentation
> buffer is designed to be read by another process such as jstat tool so that
> we can monitor a running VM without  interfering its execution.

I see now it's been generated from the Perf class so I can understand
why the LongBuffer is being used.

As to locking get(), it gets a little more interesting if the values
are being retrieved from a different process.  However, presumably the
get() method is invoked on the VM being probed rather than the VM
running jstat, etc. otherwise the wrong buffer would be read.  So the
lock should still serve its purpose.

>>> What is the purpose of d3dAvailable?  I don't know this piece of code
>>> so I'm not sure what it's counting, but it will presumably be zero
>>> forever on non-Windows systems.
>> Mandy can say more about this, but it essentially allows jstat to see if
>> the target VM is using the D3D pipeline or not.
> Exactly.  D3D pipeline is not always available on all Windows machines and
> it depends on the graphic board, the OS version, and other configuration.
>  We have been doing startup performance measurement on various systems and
> there is perf difference with D3D available or not.  Adding a counter (it
> should be a constant counter) to indicate if D3D pipeline is available would
> be useful.
> Note that d3dAvailable is only added when running on Windows.  On
> Solaris/Linux, ClientCounters class will not be initialized and thus
> d3dAvailable is not added.  I should add a comment to describe about
> platform-specific counters or optional counters.

Thanks, this makes sense now.

> Mandy
>> -Alan.

Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (

Support Free Java!
Contribute to GNU Classpath and the OpenJDK

PGP Key: 94EFD9D8 (
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

More information about the core-libs-dev mailing list