forked from OSchip/llvm-project
Improve ThreadedQuarantineTest heap memory measurements.
Summary: Warm up ASAN caches in ThreadedQuarantineTest to get more predictable incremental heap memory usage measurements. Reviewers: eugenis Patch by Alex Shlyapnikov. Subscribers: aemerson, kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D28061 llvm-svn: 290371
This commit is contained in:
parent
53ddc1d0f4
commit
055f506c54
|
@ -170,6 +170,12 @@ void *ThreadedQuarantineTestWorker(void *unused) {
|
|||
// 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++) {
|
||||
|
@ -178,7 +184,7 @@ TEST(AddressSanitizer, ThreadedQuarantineTest) {
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue