hotspot/src/share/vm/gc/g1/g1RemSetSummary.cpp
changeset 46652 ab8716d193bb
parent 46614 ae1105fff9e4
equal deleted inserted replaced
46650:642365ee2b92 46652:ab8716d193bb
    50     _counter++;
    50     _counter++;
    51   }
    51   }
    52 };
    52 };
    53 
    53 
    54 void G1RemSetSummary::update() {
    54 void G1RemSetSummary::update() {
    55   _num_conc_refined_cards = remset()->num_conc_refined_cards();
    55   _num_conc_refined_cards = _rem_set->num_conc_refined_cards();
    56   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
    56   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
    57   _num_processed_buf_mutator = dcqs.processed_buffers_mut();
    57   _num_processed_buf_mutator = dcqs.processed_buffers_mut();
    58   _num_processed_buf_rs_threads = dcqs.processed_buffers_rs_thread();
    58   _num_processed_buf_rs_threads = dcqs.processed_buffers_rs_thread();
    59 
    59 
    60   _num_coarsenings = HeapRegionRemSet::n_coarsenings();
    60   _num_coarsenings = HeapRegionRemSet::n_coarsenings();
    77   assert(_rs_threads_vtimes != NULL, "just checking");
    77   assert(_rs_threads_vtimes != NULL, "just checking");
    78   assert(thread < _num_vtimes, "just checking");
    78   assert(thread < _num_vtimes, "just checking");
    79   return _rs_threads_vtimes[thread];
    79   return _rs_threads_vtimes[thread];
    80 }
    80 }
    81 
    81 
    82 void G1RemSetSummary::initialize(G1RemSet* remset) {
       
    83   assert(_rs_threads_vtimes == NULL, "just checking");
       
    84   assert(remset != NULL, "just checking");
       
    85 
       
    86   _remset = remset;
       
    87   _num_vtimes = ConcurrentG1Refine::thread_num();
       
    88   _rs_threads_vtimes = NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC);
       
    89   memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
       
    90 
       
    91   update();
       
    92 }
       
    93 
       
    94 G1RemSetSummary::G1RemSetSummary() :
    82 G1RemSetSummary::G1RemSetSummary() :
    95   _remset(NULL),
    83   _rem_set(NULL),
    96   _num_conc_refined_cards(0),
    84   _num_conc_refined_cards(0),
    97   _num_processed_buf_mutator(0),
    85   _num_processed_buf_mutator(0),
    98   _num_processed_buf_rs_threads(0),
    86   _num_processed_buf_rs_threads(0),
    99   _num_coarsenings(0),
    87   _num_coarsenings(0),
   100   _rs_threads_vtimes(NULL),
    88   _num_vtimes(ConcurrentG1Refine::thread_num()),
   101   _num_vtimes(0),
    89   _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
   102   _sampling_thread_vtime(0.0f) {
    90   _sampling_thread_vtime(0.0f) {
       
    91 
       
    92   memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
       
    93 }
       
    94 
       
    95 G1RemSetSummary::G1RemSetSummary(G1RemSet* rem_set) :
       
    96   _rem_set(rem_set),
       
    97   _num_conc_refined_cards(0),
       
    98   _num_processed_buf_mutator(0),
       
    99   _num_processed_buf_rs_threads(0),
       
   100   _num_coarsenings(0),
       
   101   _num_vtimes(ConcurrentG1Refine::thread_num()),
       
   102   _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
       
   103   _sampling_thread_vtime(0.0f) {
       
   104   update();
   103 }
   105 }
   104 
   106 
   105 G1RemSetSummary::~G1RemSetSummary() {
   107 G1RemSetSummary::~G1RemSetSummary() {
   106   if (_rs_threads_vtimes) {
   108   if (_rs_threads_vtimes) {
   107     FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
   109     FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
   108   }
   110   }
   109 }
   111 }
   110 
   112 
   111 void G1RemSetSummary::set(G1RemSetSummary* other) {
   113 void G1RemSetSummary::set(G1RemSetSummary* other) {
   112   assert(other != NULL, "just checking");
   114   assert(other != NULL, "just checking");
   113   assert(remset() == other->remset(), "just checking");
       
   114   assert(_num_vtimes == other->_num_vtimes, "just checking");
   115   assert(_num_vtimes == other->_num_vtimes, "just checking");
   115 
   116 
   116   _num_conc_refined_cards = other->num_conc_refined_cards();
   117   _num_conc_refined_cards = other->num_conc_refined_cards();
   117 
   118 
   118   _num_processed_buf_mutator = other->num_processed_buf_mutator();
   119   _num_processed_buf_mutator = other->num_processed_buf_mutator();
   125   set_sampling_thread_vtime(other->sampling_thread_vtime());
   126   set_sampling_thread_vtime(other->sampling_thread_vtime());
   126 }
   127 }
   127 
   128 
   128 void G1RemSetSummary::subtract_from(G1RemSetSummary* other) {
   129 void G1RemSetSummary::subtract_from(G1RemSetSummary* other) {
   129   assert(other != NULL, "just checking");
   130   assert(other != NULL, "just checking");
   130   assert(remset() == other->remset(), "just checking");
       
   131   assert(_num_vtimes == other->_num_vtimes, "just checking");
   131   assert(_num_vtimes == other->_num_vtimes, "just checking");
   132 
   132 
   133   _num_conc_refined_cards = other->num_conc_refined_cards() - _num_conc_refined_cards;
   133   _num_conc_refined_cards = other->num_conc_refined_cards() - _num_conc_refined_cards;
   134 
   134 
   135   _num_processed_buf_mutator = other->num_processed_buf_mutator() - _num_processed_buf_mutator;
   135   _num_processed_buf_mutator = other->num_processed_buf_mutator() - _num_processed_buf_mutator;