Way to count run-time numbers

Manas Thakur manasthakur17 at gmail.com
Mon Feb 5 06:18:23 UTC 2018


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.

>> 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.

Regards,
Manas



More information about the hotspot-dev mailing list