Missing samples in profiler?

Using julia 1.6 it seems the the number reported for the top level of the call I make in @profile is often much smaller than the reported number of samples:

julia> @profile (for i=1:100; RBSilly.fit(RBSilly.yx, 0.0002, 4); end)

julia> Profile.print()
Overhead ╎ [+additional indent] Count File:Line; Function
  ╎64  @Base/task.jl:406; (::VSCodeServer.var"#60#61")()
  ╎ 64  @VSCodeServer/src/eval.jl:34; macro expansion
Total snapshots: 130

If there are 130 snapshots, how do I end up with only 64 observations of my top-level call?

The sum of all values in the overhead column (whose meaning is unclear to me and others), is 64, oddly identical to the 64 shown above. If I add the overhead to the top-level count of 64 it’s 128, which is close to, but still not quite, the 130 snapshots.

The line with the largest overhead is

17╎    ╎    ╎    ╎    ╎    ╎   17  ...stdlib/v1.6/LinearAlgebra/src/blas.jl:844; symv!(uplo::Char, alpha::Float64, A::Matrix{Float64}, x::V...

which looks as if the overhead is time spent in an external BLAS library. It also looks as if the two 17’s are reporting the same thing, in which case adding the overheads to the call count as I did above is double-counting.

Some libraries do not report where they are called from. You can see the extra frames by passing C=true. Though IIRC, there was a linux bug which made us double-count the number of snapshots, but I thought the fix for that was included in v1.6. Are you on macOS?–more system libraries are compiled without caller info there.

I’m on linux.