JMH - Difference between getPrimaryResults and getSecondaryResults

What is the difference between methods getPrimaryResultsand getSecondaryResultsclass RunResultsin JMH?

+4
source share
1 answer

I did not test it based on the code, but as I understand it, the primary results are numbers that are produced exclusively by JMH (time measurements), while the secondary results are obtained using additional tools, such as profilers.

UPDATE: I just saw that StackProfiler is part of JMH, which means that my definition is not entirely correct.

UPDATE 2: Meanwhile, Alexei Shipilev gave a clearer definition in his comment.

, . '-prof stack'

[java] Iteration  10: 104439194.250 ±(99.9%) 7883662.439 ns/op
[java]                  ·stack: <delayed till summary>
...
[java]   118162555.108 ±(99.9%) 8317229.030 ns/op [Average]
[java]   (min, avg, max) = (102325413.750, 118162555.108, 149303159.000), stdev = 12448837.807
[java]   CI (99.9%): [109845326.078, 126479784.138] (assumes normal distribution)
...
[java] Secondary result "·stack":
[java] Stack profiler:
[java] ....[Thread state distributions]....................................................................
[java]  87.3%         RUNNABLE
[java]  12.7%         WAITING
[java] ....[Thread state: RUNNABLE]....................................................................    ....
[java]  82.3%  94.3% sun.management.ThreadImpl.getThreadTotalCpuTime0

, . , .

+1

Source: https://habr.com/ru/post/1622145/


All Articles