The macros from BenchmarkTools seem to report the correct times:
julia> using BenchmarkTools
julia> @belapsed f(100,1e6)
4.345676228
julia> @benchmark f(100,1e6)
BechmarkTools.Trial: 2 samples with 1 evaluations.
Range (min … max): 4.834 s … 4.922 s ┊ GC (min … max): 5.16% … 5.45%
Time (median): 4.878 s ┊ GC (median): 5.31%
Time (mean ± σ): 4.878 s ± 62.011 ms ┊ GC (mean ± σ): 5.31% ± 0.21%
█ ██
█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█ ▁
4.83 s Histogram: frequency by time 4.92 s <
Memory estimate: 8.94 GiB, allocs estimate: 100004891.