< prev index next >

test/hotspot/gtest/gc/shared/test_ptrQueueBufferAllocator.cpp

Print this page




 207                                           allocator,
 208                                           cbl,
 209                                           &processor_running);
 210     proc_threads[i]->doit();
 211   }
 212 
 213   AllocatorThread* alloc_threads[nthreads] = {};
 214   for (uint i = 0; i < nthreads; ++i) {
 215     alloc_threads[i] = new AllocatorThread(&post,
 216                                            allocator,
 217                                            cbl,
 218                                            &total_allocations,
 219                                            &allocator_running);
 220     alloc_threads[i]->doit();
 221   }
 222 
 223   JavaThread* this_thread = JavaThread::current();
 224   tty->print_cr("Stressing allocator for %u ms", milliseconds_to_run);
 225   {
 226     ThreadInVMfromNative invm(this_thread);
 227     os::sleep(this_thread, milliseconds_to_run, true);
 228   }
 229   OrderAccess::release_store(&allocator_running, false);
 230   for (uint i = 0; i < nthreads; ++i) {
 231     ThreadInVMfromNative invm(this_thread);
 232     post.wait_with_safepoint_check(this_thread);
 233   }
 234   OrderAccess::release_store(&processor_running, false);
 235   for (uint i = 0; i < nthreads; ++i) {
 236     ThreadInVMfromNative invm(this_thread);
 237     post.wait_with_safepoint_check(this_thread);
 238   }
 239   ASSERT_TRUE(BufferNode::TestSupport::try_transfer_pending(allocator));
 240   tty->print_cr("total allocations: " SIZE_FORMAT, total_allocations);
 241   tty->print_cr("allocator free count: " SIZE_FORMAT, allocator->free_count());
 242 }
 243 
 244 const size_t buffer_size = 1024;
 245 
 246 TEST_VM(PtrQueueBufferAllocatorTest, stress_free_list_allocator) {
 247   BufferNode::Allocator allocator("Test Allocator", buffer_size);


 207                                           allocator,
 208                                           cbl,
 209                                           &processor_running);
 210     proc_threads[i]->doit();
 211   }
 212 
 213   AllocatorThread* alloc_threads[nthreads] = {};
 214   for (uint i = 0; i < nthreads; ++i) {
 215     alloc_threads[i] = new AllocatorThread(&post,
 216                                            allocator,
 217                                            cbl,
 218                                            &total_allocations,
 219                                            &allocator_running);
 220     alloc_threads[i]->doit();
 221   }
 222 
 223   JavaThread* this_thread = JavaThread::current();
 224   tty->print_cr("Stressing allocator for %u ms", milliseconds_to_run);
 225   {
 226     ThreadInVMfromNative invm(this_thread);
 227     os::sleep(this_thread, milliseconds_to_run);
 228   }
 229   OrderAccess::release_store(&allocator_running, false);
 230   for (uint i = 0; i < nthreads; ++i) {
 231     ThreadInVMfromNative invm(this_thread);
 232     post.wait_with_safepoint_check(this_thread);
 233   }
 234   OrderAccess::release_store(&processor_running, false);
 235   for (uint i = 0; i < nthreads; ++i) {
 236     ThreadInVMfromNative invm(this_thread);
 237     post.wait_with_safepoint_check(this_thread);
 238   }
 239   ASSERT_TRUE(BufferNode::TestSupport::try_transfer_pending(allocator));
 240   tty->print_cr("total allocations: " SIZE_FORMAT, total_allocations);
 241   tty->print_cr("allocator free count: " SIZE_FORMAT, allocator->free_count());
 242 }
 243 
 244 const size_t buffer_size = 1024;
 245 
 246 TEST_VM(PtrQueueBufferAllocatorTest, stress_free_list_allocator) {
 247   BufferNode::Allocator allocator("Test Allocator", buffer_size);
< prev index next >