%ld instead of %d for LogCompilation counts?
Chris Newland
cnewland at chrisnewland.com
Mon Dec 8 11:56:06 UTC 2014
Hi Vladimir,
The believe the only other LogCompilation output where %g is used for a
cardinal number is this one?
share/vm/opto/parse1.cpp:443:
log->begin_head("parse method='%d' uses='%g'",
log->identify(parse_method), expected_uses);
Kind regards,
Chris
On Fri, December 5, 2014 23:34, Vladimir Kozlov wrote:
> Hi,
>
>
> The output was produced by following lines:
>
>
> C->log()->elem("branch target_bci='%d' taken='%d' not_taken='%d'
> cnt='%g' prob='%s'", iter().get_dest(), taken, not_taken, cnt, prob_str);
>
> 'cnt' is declared as 'float' and defined as:
>
>
> cnt = (taken + not_taken) / FreqCountInvocations;
>
> I think it is artifact from long time ago when FreqCountInvocations was
>
>> 1. And to avoid integer overflow, so we want to keep variable as float.
>>
>
> But I am fine to change log output to long by converting it to
> (jlong)cnt and using JLONG_FORMAT format.
>
>
> Do you know other places where we use %g for counters?
>
>
> Thanks,
> Vladimir
>
>
> On 12/5/14 1:09 PM, Chris Newland wrote:
>
>> Hi,
>>
>>
>> I've encountered some LogCompilation counters in 8u25 that are getting
>> printed in exponential form in hotspot.log :
>>
>> <branch target_bci='20' taken='23867' not_taken='2386581'
>> cnt='2.38658e+06' prob='0.00990148'/>
>>
>> This is harder to parse and loses accuracy because %d is used as a
>> formatter in hotspot/src/share/vm/opto/parse2.cpp:
>>
>> if (C->log() != NULL) { C->log()->elem("branch target_bci='%d'
>> taken='%d' not_taken='%d'", iter().get_dest(), taken, not_taken); }
>>
>>
>> Would it be possible to modify some or all of the LogCompilation format
>> strings to use %ld so that large integers can be printed without
>> exponents?
>>
>> I don't mind going through the OpenJDK motions to submit this as a
>> patch if it's a sensible idea.
>>
>> Thanks,
>>
>>
>> Chris
>>
>>
>
More information about the hotspot-compiler-dev
mailing list