Average time computation just prints out "10??"

David Karr davidmichaelkarr at gmail.com
Mon Oct 1 15:27:07 UTC 2018


On Mon, Oct 1, 2018 at 12:50 AM Aleksey Shipilev <shade at redhat.com> wrote:

> On 10/01/2018 03:44 AM, David Karr wrote:
> > On Sun, Sep 30, 2018 at 4:34 AM Aleksey Shipilev <shade at redhat.com
> <mailto:shade at redhat.com>> wrote:
> >     On 09/30/2018 03:02 AM, David Karr wrote:
> >     > On Sat, Sep 29, 2018 at 4:57 PM Bernd Eckenfels <
> ecki at zusammenkunft.net
> >     > printing.  This produces a text line like this:
> >     > -----------------
> >     > # Warmup Iteration   1: ≈ 10⁻⁵ s/op
> >     > -----------------
>
> This mentions "warmup" iteration.
>
> > Ok, so HOW do I set the time units to microseconds?  I tried adding the
> following as a class annotation:
> >
> >     @Measurement(timeUnit = TimeUnit.MICROSECONDS)
>
> This sets up "measurement" iteration. Putting the parameters to @Warmup
> should be enough.
>

That doesn't really seem like a clear answer, but in any case, I changed
the class annotation, adding a @Warmup annotation.  I let the run finish
completely.  Every statistic was "s/op", and had the encoded characters.

If it matters, here's the entire skeleton of the class:

    @Measurement(timeUnit = TimeUnit.MICROSECONDS)
    @Warmup(timeUnit = TimeUnit.MICROSECONDS)
    public class MyBenchmark {
        @Benchmark
        @BenchmarkMode(value = { Mode.AverageTime})
        public void createBigDecimalFromFormattedDouble() {
            ...
        }

        @Benchmark
        @BenchmarkMode(value = { Mode.AverageTime})
        public void createBigDecimalFromDoubleWithScale() {
            ...
        }
    }



> -Aleksey
>
>


More information about the jmh-dev mailing list