================
@@ -1441,6 +1458,22 @@ Error PrintProgramStats::runOnFunctions(BinaryContext
&BC) {
StaleSampleCount += SampleCount;
++NumAllStaleFunctions;
}
+
+ if (opts::ShowDensity) {
+ uint64_t Size = Function.getSize();
+ // In case of BOLT split functions registered in BAT, executed traces are
+ // automatically attributed to the main fragment. Add up function sizes
+ // for all fragments.
+ if (IsHotParentOfBOLTSplitFunction)
+ for (const BinaryFunction *Fragment : Function.getFragments())
+ Size += Fragment->getSize();
+ double Density = (double)1.0 * Function.getExecutedBytes() / Size;
+ FuncDensityList.emplace_back(Density, SampleCount);
----------------
wlei-llvm wrote:
If there is no special reason to use `SampleCount` here, how about using
`ExecutedBytes` to be consistent? We use the same value for
FDO(https://github.com/llvm/llvm-project/blob/main/llvm/tools/llvm-profgen/ProfileGenerator.cpp#L807-L809).
https://github.com/llvm/llvm-project/pull/101094
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits