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

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 11:42:27 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;
----------------
wlei-llvm wrote:

> Should we categorize them as `NumStaleProfileFunc` (has profile with same name but CFG checksum mismatches) and `NumNoProfileFunc` (no profile for the function at all, but we may recover a profile after we handle function renaming)?

Sounds good (IIUC, this will add a new stats `NumNoProfileFunc`, this way we will have 3 function number related stats: `TotalProfiledFunc`, `NumStaleProfileFunc`, `NumNoProfileFunc`. )


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


More information about the llvm-commits mailing list