[llvm] [llvm-profgen] Add --sample-period to estimate absolute counts (PR #99826)
Tim Creech via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 05:56:16 PDT 2024
tcreech-intel wrote:
> But when processing profile, we know the exact depth of each LBR sample?
Yes, this should be `Sample->LBRStack.size()`.
> In this case, the multiplier doesn't have to be sampling period, instead it just needs to be something bigger than max LBR depth? It's sort of like a normalizing factor.. So I think we can get away with something simpler than actual sample period
Yes, for purposes of normalizing LBR and IP-only profiles with uniform sampling period I think that's true. It doesn't allow a user to compare profiles of different sampling periods, though, and I think that will be a useful capability. (Both perf and SEP support per-event periods.)
With a fixed normalizing factor users in that case would need to use their sampling periods to come up with an adjustment factor and apply it with `llvm-profdata merge`. I certainly understand the appeal of organizing the tooling this way, but I do worry some users will have trouble with this extra step.
> we don't want to suggest that user need to provide the actual sampling period
Stepping back a bit, another direction might be to have `llvm-profgen` run `perf script` asking for the "`period`" field, i.e., to include the sampling period associated with each sample. (In general perf allows for the period to vary within a profile.) This could be optional behavior. Do you think that might be reasonable?
https://github.com/llvm/llvm-project/pull/99826
More information about the llvm-commits
mailing list