Reporting Internal Functions

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Aug 25 08:16:32 UTC 2014


Hi Volkan,

What Bernd said.

JMH is not a magic wand which can introspect your code, you have to
explicitly mark what you want to measure with @Benchmark. If you are
looking for a way to see where the time is spent within the @Benchmark
call, use either bundled JMH profilers (-prof stack, -prof perfasm), or
external profilers (VisualVM, JMC, etc.).

Thanks,
-Aleksey.

On 08/23/2014 06:21 PM, Bernd wrote:
> Hello,
> 
> I guess the obvious thing is to put a @Benchmark on g() and h(). ;)
> 
> But I think what you are asking for is one of the profilers. I suspect they
> will either be inaccurate or affect your result, so it is better to try to
> measure the code segments you care about seperate (but this has its own
> issues as they might get differently optimized and inlined).
> 
> Gruss
> Bernd
> Am 23.08.2014 14:15 schrieb "Volkan YAZICI" <volkan.yazici at gmail.com>:
> 
>> Hi,
>>
>> I have a function as follows.
>>
>>     @Benchmark
>>     void f() {
>>         g(h());
>>     }
>>
>> Put another way, f() is an entry point for g() and h(). Is it possible to
>> make JMH to measure the performance of g() and h() individually?
>>
>> Best.
>>




More information about the jmh-dev mailing list