Incorrect arguments is passed to sun.misc.Perf#createLong

Yasumasa Suenaga suenaga.yasumasa at lab.ntt.co.jp
Fri Apr 19 05:07:55 UTC 2013


Hi Mandy,

Thank you so much for your cooperation.

> FYI. While looking at the hotspot implementation, I found a bug that creates the long counter of incorrect type (it got V_Variable and V_Monotonic reverse). I have file a hotspot bug and suggested a patch:

I didn't realize it :-)
Please fix it too!


Thanks,

Yasumasa


On 2013/04/19 5:41, Mandy Chung wrote:
> I have pushed the changeset:http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3b81fac25d26
>
> FYI. While looking at the hotspot implementation, I found a bug that creates the long counter of incorrect type (it got V_Variable and V_Monotonic reverse). I have file a hotspot bug and suggested a patch:
> 8012641: Perf_CreateLong creates perf counter of incorrect type
>
> Mandy
>
> On 4/17/13 2:26 PM, Mandy Chung wrote:
>> Hi Yasumasa,
>>
>> Thanks for the patch. I'm going to sponsor your fix for 8011934 and will be pushing it shortly.
>> http://cr.openjdk.java.net/~mchung/jdk8/webrevs/8011934/webrev.00/
>>
>> Mandy
>>
>> On 4/10/2013 6:59 PM, Yasu wrote:
>>> Hi Mandy,
>>>
>>> On 4:59, Mandy Chung wrote:
>>>> Hi Yasumasa,
>>>>
>>>> I'm adding core-libs and bcc serviceability-dev to move this thread to core-libs for sun.misc.PerfCounter discussion.
>>>>
>>>> On 4/9/2013 4:50 AM, Yasu wrote:
>>>>> Hi,
>>>>>
>>>>> I'm trying to create entry from Java program to hsperfdata through sun.misc.PerfCounter .
>>>>
>>>> First of all, sun.misc.PerfCounter is a private API that is not supported and may be changed and removed in any future release. I'm curious how you create a counter in hsperfdata through sun.misc.PerfCounter. The constructor is private.
>>>
>>> I've understood that sun.* packages is private API.
>>> I use PerfCounter with reflection API ( setAccessible(true) ) .
>>>
>>>
>>>>> However, I cannot watch the updated value in my entry through the jstat with interval option.
>>>>>
>>>>> I guess this cause is that wrong arguments are passed from PerfCounter#<init> to Perf#createLong .
>>>>>
>>>>
>>>> Indeed - it's a bug that calls Perf.createLong with the incorrect parameters. I have filed a bug (8011934).
>>>
>>> Thanks!
>>>
>>>
>>>> Have you signed the OCA [1]?
>>>
>>> Yes.
>>> I already sent OCA with my signature.
>>>
>>>
>>> Thanks,
>>>
>>> Yasumasa
>>>
>>>> Thanks
>>>> Mandy
>>>> [1] http://openjdk.java.net/contribute/
>>>>
>>>>> sun.misc.PerfCounter:
>>>>> ---------
>>>>> private PerfCounter(String name, int type) {
>>>>> this.name = name;
>>>>> ByteBuffer bb = perf.createLong(name, U_None, type, 0L);
>>>>> bb.order(ByteOrder.nativeOrder());
>>>>> this.lb = bb.asLongBuffer();
>>>>> }
>>>>> ---------
>>>>>
>>>>> sun.misc.Perf:
>>>>> ---------
>>>>> public native ByteBuffer createLong(String name, int variability,
>>>>> int units, long value);
>>>>> ---------
>>>>>
>>>>> "type" in constructor of PerfCounter means "variability".
>>>>> So "type" should be set to 2nd argument in perf.createLong()
>>>>>
>>>>> perf.createLong() should be called as following:
>>>>> ---------
>>>>> ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
>>>>> ---------
>>>>>
>>>>>
>>>>> I've applied a patch which is attached in this email, it's works fine.
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Yasumasa
>>>
>>




More information about the core-libs-dev mailing list