is it possible to normalize the results by a @Param?

Aleksey Shipilev shade at redhat.com
Thu Dec 15 21:43:55 UTC 2016


On 12/14/2016 07:19 PM, Travis Downs wrote:
> I'd like to run some benchmark for various @Param values (say the length of
> an array), and then have the -bm avgt results reported normalized (divided)
> by the parram value, so the results are effectively "time per element"
> rather than "time for the whole (variable length" array.
> 
> Any intrinsic way to do it? I know about @OperationsPerInvocation, but it's
> value is fixed in the code so I think it doesn't help here (I could of
> course create N benchmarks with different OperationsPerInvocation
> annotations, but I lose a lot of the niceness of @Param in that case, and
> @Setup is more complicated).

No, it is not possible with annotations. But, you can always pull the data from
Java API, and do whatever you want with it, including constructing your own
runners that process the data in ways you want.

Thanks,
-Aleksey



More information about the jmh-dev mailing list