< prev index next >

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

Print this page
rev 13028 : imported patch 8178148-more-detailed-scan-rs-logging
rev 13029 : imported patch 8178148-sangheon-review
   1 /*
   2  * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  61   _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots (ms):");
  62   _gc_par_phases[SATBFiltering] = new WorkerDataArray<double>(max_gc_threads, "SATB Filtering (ms):");
  63 
  64   _gc_par_phases[UpdateRS] = new WorkerDataArray<double>(max_gc_threads, "Update RS (ms):");
  65   if (G1HotCardCache::default_use_cache()) {
  66     _gc_par_phases[ScanHCC] = new WorkerDataArray<double>(max_gc_threads, "Scan HCC (ms):");
  67   } else {
  68     _gc_par_phases[ScanHCC] = NULL;
  69   }
  70   _gc_par_phases[ScanRS] = new WorkerDataArray<double>(max_gc_threads, "Scan RS (ms):");
  71   _gc_par_phases[CodeRoots] = new WorkerDataArray<double>(max_gc_threads, "Code Root Scanning (ms):");
  72 #if INCLUDE_AOT
  73   _gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>(max_gc_threads, "AOT Root Scanning (ms):");
  74 #endif
  75   _gc_par_phases[ObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Object Copy (ms):");
  76   _gc_par_phases[Termination] = new WorkerDataArray<double>(max_gc_threads, "Termination (ms):");
  77   _gc_par_phases[GCWorkerTotal] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Total (ms):");
  78   _gc_par_phases[GCWorkerEnd] = new WorkerDataArray<double>(max_gc_threads, "GC Worker End (ms):");
  79   _gc_par_phases[Other] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Other (ms):");
  80 







  81   _update_rs_processed_buffers = new WorkerDataArray<size_t>(max_gc_threads, "Processed Buffers:");
  82   _gc_par_phases[UpdateRS]->link_thread_work_items(_update_rs_processed_buffers);
  83 
  84   _termination_attempts = new WorkerDataArray<size_t>(max_gc_threads, "Termination Attempts:");
  85   _gc_par_phases[Termination]->link_thread_work_items(_termination_attempts);
  86 
  87   if (UseStringDeduplication) {
  88     _gc_par_phases[StringDedupQueueFixup] = new WorkerDataArray<double>(max_gc_threads, "Queue Fixup (ms):");
  89     _gc_par_phases[StringDedupTableFixup] = new WorkerDataArray<double>(max_gc_threads, "Table Fixup (ms):");
  90   } else {
  91     _gc_par_phases[StringDedupQueueFixup] = NULL;
  92     _gc_par_phases[StringDedupTableFixup] = NULL;
  93   }
  94 
  95   _gc_par_phases[RedirtyCards] = new WorkerDataArray<double>(max_gc_threads, "Parallel Redirty (ms):");
  96   _redirtied_cards = new WorkerDataArray<size_t>(max_gc_threads, "Redirtied Cards:");
  97   _gc_par_phases[RedirtyCards]->link_thread_work_items(_redirtied_cards);
  98 
  99   _gc_par_phases[YoungFreeCSet] = new WorkerDataArray<double>(max_gc_threads, "Young Free Collection Set (ms):");
 100   _gc_par_phases[NonYoungFreeCSet] = new WorkerDataArray<double>(max_gc_threads, "Non-Young Free Collection Set (ms):");


 193       ASSERT_PHASE_UNINITIALIZED(ScanRS);
 194       ASSERT_PHASE_UNINITIALIZED(CodeRoots);
 195       ASSERT_PHASE_UNINITIALIZED(ObjCopy);
 196       ASSERT_PHASE_UNINITIALIZED(Termination);
 197     }
 198   }
 199 }
 200 
 201 #undef ASSERT_PHASE_UNINITIALIZED
 202 
 203 // record the time a phase took in seconds
 204 void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_i, double secs) {
 205   _gc_par_phases[phase]->set(worker_i, secs);
 206 }
 207 
 208 // add a number of seconds to a phase
 209 void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) {
 210   _gc_par_phases[phase]->add(worker_i, secs);
 211 }
 212 
 213 void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_i, size_t count) {
 214   _gc_par_phases[phase]->set_thread_work_item(worker_i, count);
 215 }
 216 
 217 // return the average time for a phase in milliseconds
 218 double G1GCPhaseTimes::average_time_ms(GCParPhases phase) {
 219   return _gc_par_phases[phase]->average() * 1000.0;
 220 }
 221 
 222 size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase) {
 223   assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
 224   return _gc_par_phases[phase]->thread_work_items()->sum();
 225 }
 226 
 227 template <class T>
 228 void G1GCPhaseTimes::details(T* phase, const char* indent) const {
 229   Log(gc, phases, task) log;
 230   if (log.is_level(LogLevel::Trace)) {
 231     outputStream* trace_out = log.trace_stream();
 232     trace_out->print("%s", indent);
 233     phase->print_details_on(trace_out);
 234   }
 235 }
 236 
 237 void G1GCPhaseTimes::log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum) const {
 238   out->print("%s", Indents[indent]);
 239   phase->print_summary_on(out, print_sum);
 240   details(phase, Indents[indent]);
 241 
 242   WorkerDataArray<size_t>* work_items = phase->thread_work_items();

 243   if (work_items != NULL) {
 244     out->print("%s", Indents[indent + 1]);
 245     work_items->print_summary_on(out, true);
 246     details(work_items, Indents[indent + 1]);

 247   }
 248 }
 249 
 250 void G1GCPhaseTimes::debug_phase(WorkerDataArray<double>* phase) const {
 251   Log(gc, phases) log;
 252   if (log.is_level(LogLevel::Debug)) {
 253     ResourceMark rm;
 254     log_phase(phase, 2, log.debug_stream(), true);
 255   }
 256 }
 257 
 258 void G1GCPhaseTimes::trace_phase(WorkerDataArray<double>* phase, bool print_sum) const {
 259   Log(gc, phases) log;
 260   if (log.is_level(LogLevel::Trace)) {
 261     ResourceMark rm;
 262     log_phase(phase, 3, log.trace_stream(), print_sum);
 263   }
 264 }
 265 
 266 #define TIME_FORMAT "%.1lfms"


   1 /*
   2  * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  61   _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots (ms):");
  62   _gc_par_phases[SATBFiltering] = new WorkerDataArray<double>(max_gc_threads, "SATB Filtering (ms):");
  63 
  64   _gc_par_phases[UpdateRS] = new WorkerDataArray<double>(max_gc_threads, "Update RS (ms):");
  65   if (G1HotCardCache::default_use_cache()) {
  66     _gc_par_phases[ScanHCC] = new WorkerDataArray<double>(max_gc_threads, "Scan HCC (ms):");
  67   } else {
  68     _gc_par_phases[ScanHCC] = NULL;
  69   }
  70   _gc_par_phases[ScanRS] = new WorkerDataArray<double>(max_gc_threads, "Scan RS (ms):");
  71   _gc_par_phases[CodeRoots] = new WorkerDataArray<double>(max_gc_threads, "Code Root Scanning (ms):");
  72 #if INCLUDE_AOT
  73   _gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>(max_gc_threads, "AOT Root Scanning (ms):");
  74 #endif
  75   _gc_par_phases[ObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Object Copy (ms):");
  76   _gc_par_phases[Termination] = new WorkerDataArray<double>(max_gc_threads, "Termination (ms):");
  77   _gc_par_phases[GCWorkerTotal] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Total (ms):");
  78   _gc_par_phases[GCWorkerEnd] = new WorkerDataArray<double>(max_gc_threads, "GC Worker End (ms):");
  79   _gc_par_phases[Other] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Other (ms):");
  80 
  81   _scan_rs_scanned_cards = new WorkerDataArray<size_t>(max_gc_threads, "Scanned Cards:");
  82   _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_scanned_cards, ScannedCards);
  83   _scan_rs_claimed_cards = new WorkerDataArray<size_t>(max_gc_threads, "Claimed Cards:");
  84   _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_claimed_cards, ClaimedCards);
  85   _scan_rs_skipped_cards = new WorkerDataArray<size_t>(max_gc_threads, "Skipped Cards:");
  86   _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_skipped_cards, SkippedCards);
  87 
  88   _update_rs_processed_buffers = new WorkerDataArray<size_t>(max_gc_threads, "Processed Buffers:");
  89   _gc_par_phases[UpdateRS]->link_thread_work_items(_update_rs_processed_buffers);
  90 
  91   _termination_attempts = new WorkerDataArray<size_t>(max_gc_threads, "Termination Attempts:");
  92   _gc_par_phases[Termination]->link_thread_work_items(_termination_attempts);
  93 
  94   if (UseStringDeduplication) {
  95     _gc_par_phases[StringDedupQueueFixup] = new WorkerDataArray<double>(max_gc_threads, "Queue Fixup (ms):");
  96     _gc_par_phases[StringDedupTableFixup] = new WorkerDataArray<double>(max_gc_threads, "Table Fixup (ms):");
  97   } else {
  98     _gc_par_phases[StringDedupQueueFixup] = NULL;
  99     _gc_par_phases[StringDedupTableFixup] = NULL;
 100   }
 101 
 102   _gc_par_phases[RedirtyCards] = new WorkerDataArray<double>(max_gc_threads, "Parallel Redirty (ms):");
 103   _redirtied_cards = new WorkerDataArray<size_t>(max_gc_threads, "Redirtied Cards:");
 104   _gc_par_phases[RedirtyCards]->link_thread_work_items(_redirtied_cards);
 105 
 106   _gc_par_phases[YoungFreeCSet] = new WorkerDataArray<double>(max_gc_threads, "Young Free Collection Set (ms):");
 107   _gc_par_phases[NonYoungFreeCSet] = new WorkerDataArray<double>(max_gc_threads, "Non-Young Free Collection Set (ms):");


 200       ASSERT_PHASE_UNINITIALIZED(ScanRS);
 201       ASSERT_PHASE_UNINITIALIZED(CodeRoots);
 202       ASSERT_PHASE_UNINITIALIZED(ObjCopy);
 203       ASSERT_PHASE_UNINITIALIZED(Termination);
 204     }
 205   }
 206 }
 207 
 208 #undef ASSERT_PHASE_UNINITIALIZED
 209 
 210 // record the time a phase took in seconds
 211 void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_i, double secs) {
 212   _gc_par_phases[phase]->set(worker_i, secs);
 213 }
 214 
 215 // add a number of seconds to a phase
 216 void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) {
 217   _gc_par_phases[phase]->add(worker_i, secs);
 218 }
 219 
 220 void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index) {
 221   _gc_par_phases[phase]->set_thread_work_item(worker_i, count, index);
 222 }
 223 
 224 // return the average time for a phase in milliseconds
 225 double G1GCPhaseTimes::average_time_ms(GCParPhases phase) {
 226   return _gc_par_phases[phase]->average() * 1000.0;
 227 }
 228 
 229 size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase, uint index) {
 230   assert(_gc_par_phases[phase]->thread_work_items(index) != NULL, "No sub count");
 231   return _gc_par_phases[phase]->thread_work_items(index)->sum();
 232 }
 233 
 234 template <class T>
 235 void G1GCPhaseTimes::details(T* phase, const char* indent) const {
 236   Log(gc, phases, task) log;
 237   if (log.is_level(LogLevel::Trace)) {
 238     outputStream* trace_out = log.trace_stream();
 239     trace_out->print("%s", indent);
 240     phase->print_details_on(trace_out);
 241   }
 242 }
 243 
 244 void G1GCPhaseTimes::log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum) const {
 245   out->print("%s", Indents[indent]);
 246   phase->print_summary_on(out, print_sum);
 247   details(phase, Indents[indent]);
 248 
 249   for (uint i = 0; i < phase->MaxThreadWorkItems; i++) {
 250     WorkerDataArray<size_t>* work_items = phase->thread_work_items(i);
 251     if (work_items != NULL) {
 252       out->print("%s", Indents[indent + 1]);
 253       work_items->print_summary_on(out, true);
 254       details(work_items, Indents[indent + 1]);
 255     }
 256   }
 257 }
 258 
 259 void G1GCPhaseTimes::debug_phase(WorkerDataArray<double>* phase) const {
 260   Log(gc, phases) log;
 261   if (log.is_level(LogLevel::Debug)) {
 262     ResourceMark rm;
 263     log_phase(phase, 2, log.debug_stream(), true);
 264   }
 265 }
 266 
 267 void G1GCPhaseTimes::trace_phase(WorkerDataArray<double>* phase, bool print_sum) const {
 268   Log(gc, phases) log;
 269   if (log.is_level(LogLevel::Trace)) {
 270     ResourceMark rm;
 271     log_phase(phase, 3, log.trace_stream(), print_sum);
 272   }
 273 }
 274 
 275 #define TIME_FORMAT "%.1lfms"


< prev index next >