specializing jvmArgs in a derived class
Deneau, Tom
tom.deneau at amd.com
Fri Aug 22 20:05:46 UTC 2014
Aleksey --
I see your point about making @Benchmark be in the derived classes.
I only did it the other way because 90% of the time, it doesn't need to be overridden with anything.
But perhaps some restructuring would be better...
-- Tom
-----Original Message-----
From: Aleksey Shipilev [mailto:aleksey.shipilev at oracle.com]
Sent: Friday, August 22, 2014 2:53 PM
To: Deneau, Tom; jmh-dev at openjdk.java.net
Subject: Re: specializing jvmArgs in a derived class
Hi Tom,
On 08/22/2014 09:16 PM, Deneau, Tom wrote:
> I have a base class with
> @Benchmark
> public void myBenchmark()
>
> and several derived classes that specialize that benchmark.
> In one of the derived classes, I would like to specify that when that derived class forks, certain jvmArgs get added to the jvm command line. Is there a way to do this?
>
> When I tried this in the derived class
>
> @Override
> @Benchmark
> @Fork(jvmArgs="...")
> public void myBenchmark()
>
> I got this error which I don't really understand:
> Internal error: multiple methods per @Group, but not all methods
> have @Group
This is because JMH treats super-class @Benchmark as the benchmark sibling on par with the sub-class @Benchmark, ignoring the fact the super-class is overridden by Java rules. This should be fixed to at least print a sane error message.
In your case, I would rather make the non- at Benchmark method in the super-class, and override it with @Benchmark in each subclass. Do you really need the @Benchmark on the super-class method in your scenario?
-Aleksey.
More information about the jmh-dev
mailing list