[llvm] [CSSPGO] Compute and report profile matching recovered callsites and samples (PR #79090)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 22:51:58 PST 2024


================
@@ -444,15 +444,34 @@ class SampleProfileMatcher {
   // the profile.
   StringMap<LocToLocMap> FuncMappings;
 
-  // Profile mismatching statstics.
+  // Match state for an anchor/callsite.
+  enum class MatchState {
+    Matched = 0,
+    Mismatched = 0x1,
+    Recovered = 0x1,
+  };
+
+  // For each function, store every callsite state into a map, of which each
+  // entry is a pair of callsite location and MatchState. This is used for
+  // profile stalness computation and report.
+  StringMap<std::unordered_map<LineLocation, MatchState, LineLocationHash>>
+      FuncCallsiteMatchStates;
+
+  /// Profile mismatch statstics:
+  uint64_t TotalProfiledFunc = 0;
+  // Num of function whose checksum is mismatched.
+  uint64_t NumMismatchedFunc = 0;
   uint64_t TotalProfiledCallsites = 0;
   uint64_t NumMismatchedCallsites = 0;
+  uint64_t NumRecoveredCallsites = 0;
+
+  /// Weigted profile samples mismatch statstics:
----------------
WenleiHe wrote:

nit: why `///` which is inconsistent with others. The comment is also not clear - was expecting something explaining  `TotalFunctionSamples`. 

https://github.com/llvm/llvm-project/pull/79090


More information about the llvm-commits mailing list