test/hotspot/gtest/gc/g1/test_g1FreeIdSet.cpp
changeset 59247 56bf71d64d51
parent 58095 adc72cd1d1f2
child 59249 29b0d0b61615
equal deleted inserted replaced
59246:fcad92f425c5 59247:56bf71d64d51
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "gc/g1/g1FreeIdSet.hpp"
    26 #include "gc/g1/g1FreeIdSet.hpp"
    27 #include "memory/allocation.hpp"
    27 #include "memory/allocation.hpp"
    28 #include "runtime/atomic.hpp"
    28 #include "runtime/atomic.hpp"
    29 #include "runtime/interfaceSupport.inline.hpp"
    29 #include "runtime/interfaceSupport.inline.hpp"
    30 #include "runtime/orderAccess.hpp"
       
    31 #include "runtime/semaphore.inline.hpp"
    30 #include "runtime/semaphore.inline.hpp"
    32 #include "runtime/thread.hpp"
    31 #include "runtime/thread.hpp"
    33 #include "utilities/debug.hpp"
    32 #include "utilities/debug.hpp"
    34 #include "utilities/globalDefinitions.hpp"
    33 #include "utilities/globalDefinitions.hpp"
    35 #include "utilities/ostream.hpp"
    34 #include "utilities/ostream.hpp"
   106     _allocations(0),
   105     _allocations(0),
   107     _thread_number(thread_number)
   106     _thread_number(thread_number)
   108   {}
   107   {}
   109 
   108 
   110   virtual void main_run() {
   109   virtual void main_run() {
   111     while (OrderAccess::load_acquire(_continue_running)) {
   110     while (Atomic::load_acquire(_continue_running)) {
   112       uint id = _set->claim_par_id();
   111       uint id = _set->claim_par_id();
   113       _set->release_par_id(id);
   112       _set->release_par_id(id);
   114       ++_allocations;
   113       ++_allocations;
   115       ThreadBlockInVM tbiv(this); // Safepoint check.
   114       ThreadBlockInVM tbiv(this); // Safepoint check.
   116     }
   115     }
   145   tty->print_cr("Stressing G1FreeIdSet for %u ms", milliseconds_to_run);
   144   tty->print_cr("Stressing G1FreeIdSet for %u ms", milliseconds_to_run);
   146   {
   145   {
   147     ThreadInVMfromNative invm(this_thread);
   146     ThreadInVMfromNative invm(this_thread);
   148     this_thread->sleep(milliseconds_to_run);
   147     this_thread->sleep(milliseconds_to_run);
   149   }
   148   }
   150   OrderAccess::release_store(&continue_running, false);
   149   Atomic::release_store(&continue_running, false);
   151   for (uint i = 0; i < nthreads; ++i) {
   150   for (uint i = 0; i < nthreads; ++i) {
   152     ThreadInVMfromNative invm(this_thread);
   151     ThreadInVMfromNative invm(this_thread);
   153     post.wait_with_safepoint_check(this_thread);
   152     post.wait_with_safepoint_check(this_thread);
   154   }
   153   }
   155   tty->print_cr("total allocations: " SIZE_FORMAT, total_allocations);
   154   tty->print_cr("total allocations: " SIZE_FORMAT, total_allocations);