[memprof] Remove the "Live on exit:" print for text format.
authorSnehasish Kumar <snehasishk@google.com>
Fri, 19 Nov 2021 21:13:02 +0000 (13:13 -0800)
committerSnehasish Kumar <snehasishk@google.com>
Mon, 22 Nov 2021 21:30:48 +0000 (13:30 -0800)
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

compiler-rt/lib/memprof/memprof_allocator.cpp
compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp

index 696f64d8c324af641d5e0f8a765d6335efda62c7..059ce283b8c93cad84111c7b32408394d3b01e32 100644 (file)
@@ -252,6 +252,8 @@ struct Allocator {
 
     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 @@ struct Allocator {
 
   // 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;
index b843f904d867cab9c421b2c47c2c7cd8af52b721..be0f5d5e113f4884e3a29db87998ab00db021b39 100644 (file)
@@ -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 @@ int main(int argc, char **argv) {
 }
 // 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
 //