[memprof] Remove the "Live on exit:" print for text format.
We dropped the printing of live on exit blocks in rG1243cef245f6 -
the commit changed the insertOrMerge logic. Remove the message since it
is no longer needed (all live blocks are inserted into the hashmap)
before serializing/printing the profile. Furthermore, the original
intent was to capture evicted blocks so it wasn't entirely correct.
Also update the binary format test invocation to remove the redundant
print_text directive now that it is the default.
Differential Revision: https://reviews.llvm.org/D114285
GitOrigin-RevId: a4b92d61580d9a1ef9f4946ffe8d0bb6949596a8
diff --git a/lib/memprof/memprof_allocator.cpp b/lib/memprof/memprof_allocator.cpp
index 696f64d..059ce28 100644
--- a/lib/memprof/memprof_allocator.cpp
+++ b/lib/memprof/memprof_allocator.cpp
@@ -252,6 +252,8 @@
InsertLiveBlocks();
if (print_text) {
+ if (!flags()->print_terse)
+ Printf("Recorded MIBs (incl. live on exit):\n");
MIBMap.ForEach(PrintCallback,
reinterpret_cast<void *>(flags()->print_terse));
StackDepotPrintAll();
@@ -271,9 +273,6 @@
// Inserts any blocks which have been allocated but not yet deallocated.
void InsertLiveBlocks() {
- if (print_text && !flags()->print_terse)
- Printf("Live on exit:\n");
-
allocator.ForEachChunk(
[](uptr chunk, void *alloc) {
u64 user_requested_size;
diff --git a/test/memprof/TestCases/memprof_profile_dump.cpp b/test/memprof/TestCases/memprof_profile_dump.cpp
index b843f90..be0f5d5 100644
--- a/test/memprof/TestCases/memprof_profile_dump.cpp
+++ b/test/memprof/TestCases/memprof_profile_dump.cpp
@@ -1,7 +1,7 @@
-// RUN: %clangxx_memprof %s -o %t
+// RUN: %clangxx_memprof %s -o %t
// RUN: %env_memprof_opts=print_text=true:log_path=stdout %run %t | FileCheck --check-prefix=CHECK-TEXT %s
-// RUN: %env_memprof_opts=print_text=true:log_path=stdout,print_text=false %run %t > %t.memprofraw
+// RUN: %env_memprof_opts=log_path=stdout %run %t > %t.memprofraw
// RUN: od -c -N 8 %t.memprofraw | FileCheck --check-prefix=CHECK-RAW %s
#include <sanitizer/memprof_interface.h>
@@ -19,8 +19,12 @@
}
// We should get 2 rounds of profile info, one from the explicit dump request,
// and one at exit.
+//
+// CHECK-TEXT: Recorded MIBs (incl. live on exit):
// CHECK-TEXT: Memory allocation stack id
// CHECK-TEXT: Stack for id
+//
+// CHECK-TEXT: Recorded MIBs (incl. live on exit):
// CHECK-TEXT: Memory allocation stack id
// CHECK-TEXT: Stack for id
//