Detecting when compilations occur

Thomas Wuerthinger thomas.wuerthinger at oracle.com
Thu Nov 16 13:55:45 UTC 2017


No, it does not include Truffle compile times. - thomas

> On 13 Oct 2017, at 18:11, Arthur Peters <amp at cs.utexas.edu> wrote:
> 
> Thanks!
> 
> I had not thought of CompilationMXBean for some reason. Does
> CompilationMXBean.getTotalCompilationTime() include Truffle compile
> time? Looking at the numbers it seems like it might not, but it's hard
> to tell.
> 
> -Arthur
> 
> 
> On 10/13/2017 01:17 AM, Petr Tůma wrote:
>> Hi Arthur,
>> 
>> some options, depending on what exactly you want:
>> 
>> - you could catch the JVMTI CompiledMethodLoad event callback, this
>> needs a C agent but otherwise should work quite well
>> 
>> - you could query the CompilationMXBean in java.lang.management, this
>> gives you the aggregate compilation time in milliseconds (this will
>> jump forward on compilation end but sub millisecond compilation events
>> will not be visible)
>> 
>> - you can monitor the execution time of the compiler threads
>> 
>> - you can enable the JVM compilation log (-XX:+PrintCompilation), this
>> includes time relative to JVM start so can be correlated with
>> benchmark iterations if they are long enough
>> 
>> Some of these are implemented in
>> https://github.com/D-iii-S/java-ubench-agent, you can take a look for
>> inspiration.
>> 
>> Hope this helps, Petr
>> 
>> 
>> On 13/10/17 02:47, Arthur Peters wrote:
>>> Is there any way to detect when Truffle/Graal compilations happen? (for
>>> instance by getting a callback or even just accessing a count of how
>>> many compilations have happened so I can check if it has changed.)
>>> 
>>> I would like to have this information for my benchmarking so I can
>>> easily tag repetitions of the benchmark that have a compilation. This
>>> would be useful for analyzing how fast the code generated by the
>>> compiler is independent of the compiler itself and visa versa.
>>> 
>>> -Arthur
>>> 
>>> PS: I'm not going to just remove all the repetitions with compilations.
>>> That would not really represent the performance of the language. But it
>>> would be nice to be able to do subgroup analysis.
>>> 
> 
> 



More information about the graal-dev mailing list