问题
I'm trying to measure the memory consumed when running the benchmark. I found out on the internet that I can use GC
profiler to measure that. I tried but I don't understand the answer as well as see the amount of consumed memory. Can anyone explain the results? Thanks.
MyBenchmark.testMethod_width_2_attribute_text ss 60 32.345 ± 1.759 ms/op
MyBenchmark.testMethod_width_2_attribute_text:·gc.alloc.rate ss 60 26.904 ± 0.217 MB/sec
MyBenchmark.testMethod_width_2_attribute_text:·gc.alloc.rate.norm ss 60 14999630.400 ± 12.578 B/op
MyBenchmark.testMethod_width_2_attribute_text:·gc.churn.PS_Eden_Space ss 60 28.282 ± 15.342 MB/sec
MyBenchmark.testMethod_width_2_attribute_text:·gc.churn.PS_Eden_Space.norm ss 60 15903402.667 ± 8631257.013 B/op
MyBenchmark.testMethod_width_2_attribute_text:·gc.churn.PS_Survivor_Space ss 60 0.654 ± 0.754 MB/sec
MyBenchmark.testMethod_width_2_attribute_text:·gc.churn.PS_Survivor_Space.norm ss 60 368914.667 ± 425374.152 B/op
MyBenchmark.testMethod_width_2_attribute_text:·gc.count ss 60 26.000 counts
MyBenchmark.testMethod_width_2_attribute_text:·gc.time ss 60 105.000 ms
回答1:
Under covers, jmh uses ThreadMXBean
so this looks like a report that says how many bytes per operation are allocated and how many MB/sec
in each GC space (like Eden/Survivor
)
.norm
stands for normalized.
来源:https://stackoverflow.com/questions/49037136/what-does-allocation-rate-means-in-jmh