< prev index next >

hotspot/src/share/vm/memory/genCollectedHeap.cpp

Print this page
rev 7125 : 7176220: 'Full GC' events miss date stamp information occasionally
Summary: Move date stamp logic into GCTraceTime
Reviewed-by: brutisso, tschatzl


 367   assert(max_level < n_gens(), "sanity check");
 368 
 369   if (GC_locker::check_active_before_gc()) {
 370     return; // GC is disabled (e.g. JNI GetXXXCritical operation)
 371   }
 372 
 373   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
 374                           collector_policy()->should_clear_all_soft_refs();
 375 
 376   ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
 377 
 378   const size_t metadata_prev_used = MetaspaceAux::used_bytes();
 379 
 380   print_heap_before_gc();
 381 
 382   {
 383     FlagSetting fl(_is_gc_active, true);
 384 
 385     bool complete = full && (max_level == (n_gens()-1));
 386     const char* gc_cause_prefix = complete ? "Full GC" : "GC";
 387     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
 388     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
 389     // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
 390     // so we can assume here that the next GC id is what we want.
 391     GCTraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, NULL, GCId::peek());
 392 
 393     gc_prologue(complete);
 394     increment_total_collections(complete);
 395 
 396     size_t gch_prev_used = used();
 397 
 398     int starting_level = 0;
 399     if (full) {
 400       // Search for the oldest generation which will collect all younger
 401       // generations, and start collection loop there.
 402       for (int i = max_level; i >= 0; i--) {
 403         if (_gens[i]->full_collects_younger_generations()) {
 404           starting_level = i;
 405           break;
 406         }
 407       }




 367   assert(max_level < n_gens(), "sanity check");
 368 
 369   if (GC_locker::check_active_before_gc()) {
 370     return; // GC is disabled (e.g. JNI GetXXXCritical operation)
 371   }
 372 
 373   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
 374                           collector_policy()->should_clear_all_soft_refs();
 375 
 376   ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
 377 
 378   const size_t metadata_prev_used = MetaspaceAux::used_bytes();
 379 
 380   print_heap_before_gc();
 381 
 382   {
 383     FlagSetting fl(_is_gc_active, true);
 384 
 385     bool complete = full && (max_level == (n_gens()-1));
 386     const char* gc_cause_prefix = complete ? "Full GC" : "GC";

 387     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
 388     // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
 389     // so we can assume here that the next GC id is what we want.
 390     GCTraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, NULL, GCId::peek());
 391 
 392     gc_prologue(complete);
 393     increment_total_collections(complete);
 394 
 395     size_t gch_prev_used = used();
 396 
 397     int starting_level = 0;
 398     if (full) {
 399       // Search for the oldest generation which will collect all younger
 400       // generations, and start collection loop there.
 401       for (int i = max_level; i >= 0; i--) {
 402         if (_gens[i]->full_collects_younger_generations()) {
 403           starting_level = i;
 404           break;
 405         }
 406       }


< prev index next >