[PATCH] D28061: Improve ThreadedQuarantineTest heap memory measurements.

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 22 10:17:47 PST 2016


alekseyshl created this revision.
alekseyshl added a reviewer: eugenis.
alekseyshl added a subscriber: llvm-commits.
Herald added subscribers: kubabrecka, aemerson.

Warm up ASAN caches in ThreadedQuarantineTest to get more predictable
incremental heap memory usage measurements.


https://reviews.llvm.org/D28061

Files:
  lib/asan/tests/asan_noinst_test.cc


Index: lib/asan/tests/asan_noinst_test.cc
===================================================================
--- lib/asan/tests/asan_noinst_test.cc
+++ lib/asan/tests/asan_noinst_test.cc
@@ -170,15 +170,21 @@
 // Check that the thread local allocators are flushed when threads are
 // destroyed.
 TEST(AddressSanitizer, ThreadedQuarantineTest) {
+  // Run the routine once to warm up ASAN internal structures to get more
+  // predictable incremental memory changes.
+  pthread_t t;
+  PTHREAD_CREATE(&t, NULL, ThreadedQuarantineTestWorker, 0);
+  PTHREAD_JOIN(t, 0);
+
   const int n_threads = 3000;
   size_t mmaped1 = __sanitizer_get_heap_size();
   for (int i = 0; i < n_threads; i++) {
     pthread_t t;
     PTHREAD_CREATE(&t, NULL, ThreadedQuarantineTestWorker, 0);
     PTHREAD_JOIN(t, 0);
     size_t mmaped2 = __sanitizer_get_heap_size();
     // Figure out why this much memory is required.
-    EXPECT_LT(mmaped2 - mmaped1, 352U * (1 << 20));
+    EXPECT_LT(mmaped2 - mmaped1, 320U * (1 << 20));
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28061.82349.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161222/bd3a8f65/attachment.bin>


More information about the llvm-commits mailing list