< prev index next >

src/share/vm/gc/g1/g1RemSet.cpp

Print this page

        

@@ -49,11 +49,11 @@
 {
   _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
   for (uint i = 0; i < n_workers(); i++) {
     _cset_rs_update_cl[i] = NULL;
   }
-  if (G1SummarizeRSetStats) {
+  if (log_is_enabled(Trace, gc, remset)) {
     _prev_period_summary.initialize(this);
   }
 }
 
 G1RemSet::~G1RemSet() {

@@ -116,21 +116,10 @@
       _cards_done++;
       cl.do_MemRegion(mr);
     }
   }
 
-  void printCard(HeapRegion* card_region, size_t card_index,
-                 HeapWord* card_start) {
-    gclog_or_tty->print_cr("T %u Region [" PTR_FORMAT ", " PTR_FORMAT ") "
-                           "RS names card " SIZE_FORMAT_HEX ": "
-                           "[" PTR_FORMAT ", " PTR_FORMAT ")",
-                           _worker_i,
-                           p2i(card_region->bottom()), p2i(card_region->end()),
-                           card_index,
-                           p2i(card_start), p2i(card_start + G1BlockOffsetSharedArray::N_words));
-  }
-
   void scan_strong_code_roots(HeapRegion* r) {
     double scan_start = os::elapsedTime();
     r->strong_code_roots_do(_code_root_cl);
     _strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start);
   }

@@ -159,15 +148,10 @@
       if (current_card >= jump_to_card + _block_size) {
         jump_to_card = hrrs->iter_claimed_next(_block_size);
       }
       if (current_card < jump_to_card) continue;
       HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index);
-#if 0
-      gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n",
-                          card_start, card_start + CardTableModRefBS::card_size_in_words);
-#endif
-
       HeapRegion* card_region = _g1h->heap_region_containing(card_start);
       _cards++;
 
       if (!card_region->is_on_dirty_cards_region_list()) {
         _g1h->push_dirty_cards_region(card_region);

@@ -542,35 +526,40 @@
            "invalid result at non safepoint");
 
   return has_refs_into_cset;
 }
 
-void G1RemSet::print_periodic_summary_info(const char* header) {
+void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) {
+  if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) &&
+      (period_count % G1SummarizeRSetStatsPeriod == 0)) {
+
+    if (!_prev_period_summary.initialized()) {
+      _prev_period_summary.initialize(this);
+    }
+
   G1RemSetSummary current;
   current.initialize(this);
-
   _prev_period_summary.subtract_from(&current);
-  print_summary_info(&_prev_period_summary, header);
+
+    LogHandle(gc, remset) log;
+    log.trace("%s", header);
+    ResourceMark rm;
+    _prev_period_summary.print_on(log.trace_stream());
 
   _prev_period_summary.set(&current);
+  }
 }
 
 void G1RemSet::print_summary_info() {
+  LogHandle(gc, remset, exit) log;
+  if (log.is_trace()) {
+    log.trace(" Cumulative RS summary");
   G1RemSetSummary current;
   current.initialize(this);
-
-  print_summary_info(&current, " Cumulative RS summary");
-}
-
-void G1RemSet::print_summary_info(G1RemSetSummary * summary, const char * header) {
-  assert(summary != NULL, "just checking");
-
-  if (header != NULL) {
-    gclog_or_tty->print_cr("%s", header);
+    ResourceMark rm;
+    current.print_on(log.trace_stream());
   }
-
-  summary->print_on(gclog_or_tty);
 }
 
 void G1RemSet::prepare_for_verify() {
   if (G1HRRSFlushLogBuffersOnVerify &&
       (VerifyBeforeGC || VerifyAfterGC)
< prev index next >