Skip to content

Commit

Permalink
Merge pull request #2305 from yosefe/topic/test-ucm-mmap-ptrs-trim-v1…
Browse files Browse the repository at this point in the history
….3.x

TEST/UCM: Fix performance test of malloc with multiple ptrs
  • Loading branch information
yosefe authored Feb 13, 2018
2 parents dc54847 + e813fa0 commit d860257
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/gtest/ucm/malloc_hook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ UCS_TEST_F(malloc_hook_cplusplus, mmap_ptrs) {
UCS_TEST_SKIP_R("skipping on valgrind");
}

ucm_global_config.enable_dynamic_mmap_thresh = 0;
set();

const size_t size = ucm_dlmallopt_get(M_MMAP_THRESHOLD) * 2;
Expand All @@ -605,16 +606,21 @@ UCS_TEST_F(malloc_hook_cplusplus, mmap_ptrs) {
++large_blocks;
}

/* Remove memory off the heap top, to ensure the following large allocations
* will use mmap()
*/
malloc_trim(0);

/* Measure allocation time with "clear" heap state */
double alloc_time = measure_alloc_time(size, iters);
UCS_TEST_MESSAGE << "With " << large_blocks << " large blocks:"
<< " allocated " << iters << " buffers of " << size
<< " bytes in " << alloc_time << " sec";

/* Allocate many large strings to trigger mmap() based allocation. */
ptrs.resize(count);
for (unsigned i = 0; i < count; ++i) {
std::vector<char> str(size, 't');
ptrs.push_back(str);
ptrs[i].resize(size, 't');
++large_blocks;
}

Expand Down

0 comments on commit d860257

Please sign in to comment.