Get unit with @benchmark or set unit to "s"

Hello,

I know how to get the mean, median… about @benchmark, nonetheless, those values are given in the suitable unit (ms, µs, ns) but I need to know with Julia what is this unit. Or, else, set the unit to “second”.

I have to do lot of tests and executions times must be homogenous.

Thanks

The unit of measure is ns when you inspect the times vector inside the result of @benchmark:

julia> using BenchmarkTools

julia> b = @benchmark rand(10000)
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
 Range (min … max):   8.800 μs …  3.340 ms  ┊ GC (min … max):  0.00% … 98.78%
 Time  (median):      9.800 μs              ┊ GC (median):     0.00%
 Time  (mean ± σ):   20.111 μs ± 61.081 μs  ┊ GC (mean ± σ):  11.34% ±  3.98%

  █▇                    ▂▆▆▅▁                                 ▂
  ██▆▅▆▄▄▅▄▅▄▄▃▄▁▁▁▁▁▁▄██████▇▆▆▇▆▇▇▆▆▅▃▅▁▄▃▃▅▄▄▄▄▅▆▆▄▅▄▆▆▆▇█ █
  8.8 μs       Histogram: log(frequency) by time      62.3 μs <

 Memory estimate: 78.17 KiB, allocs estimate: 2.

julia> minimum(b.times)
8800.0
2 Likes