Way to count run-time numbers
David Holmes
david.holmes at oracle.com
Mon Feb 5 06:27:58 UTC 2018
On 5/02/2018 4:18 PM, Manas Thakur wrote:
> Hi David,
>
> Sorry for the confusion. Let me try to clarify:
>
>>> 1. Number of locks acquired
>>
>> Do you mean Java level monitors or internal VM Mutexes (or Monitors). Do you mean number of distinct lock instances or the number of times a "lock" has succeeded?
>
> I mean the Java level monitors. Essentially, the number of times a ‘monitorenter’ instruction is executed by all threads in the program during execution. Anything is fine: number of times it succeeds or including spinning etc.
No, there's nothing that would give that information.
>>> 2. Number of null-checks inserted
>>
>> Inserted by what? The Java source compiler may add some explicit null checks, but most are implicit in the semantics of the bytecodes. Then the JIT does what it can to elide unnecessary null-checks.
>
> Sorry; ‘inserted’ should be replaced with ‘executed’. I could find the place (in the OpenJDK source code) where the JIT compiler (C2) removes unnecessary null-checks (explicit as well as implicit in the Bytecode). I would like to count the number of times the remaining ones are executed during execution.
Again no. Most compiled "null checks" are not actual tests "if (ptr ==
NULL)" but rather the code assumes it is not null and then if we hit a
SEGV doing the access we determine that it was actually null and so
throw NullPointerException.
David
> Regards,
> Manas
>
More information about the hotspot-dev
mailing list