[compiler-rt] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 14:13:36 PDT 2024


================
@@ -216,6 +226,32 @@ u64 GetShadowCount(uptr p, u32 size) {
   return count;
 }
 
+// Accumulates the access count from the shadow for the given pointer and size.
+u64 GetShadowCountHistogram(uptr p, u32 size) {
+  u8 *shadow = (u8 *)HISTOGRAM_MEM_TO_SHADOW(p);
+  u8 *shadow_end = (u8 *)HISTOGRAM_MEM_TO_SHADOW(p + size);
+  u64 count = 0;
+  for (; shadow <= shadow_end; shadow++)
+    count += *shadow;
+  return count;
+}
+
+// If we use the normal approach in clearCountersWithoutHistogram, the histogram
----------------
teresajohnson wrote:

"from clearCountersWithoutHistogram"?

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


More information about the llvm-commits mailing list