comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 6030:48fac5d60c3c

7163848: G1: Log GC Cause for a GC Reviewed-by: johnc, jwilhelm, jmasa
author brutisso
date Wed, 25 Apr 2012 12:36:37 +0200
parents 8a2e5a6a19a4
children 3a22b77e755a
comparison
equal deleted inserted replaced
6029:ee89f2110312 6030:48fac5d60c3c
1246 1246
1247 { 1247 {
1248 IsGCActiveMark x; 1248 IsGCActiveMark x;
1249 1249
1250 // Timing 1250 // Timing
1251 bool system_gc = (gc_cause() == GCCause::_java_lang_system_gc); 1251 assert(gc_cause() != GCCause::_java_lang_system_gc || explicit_gc, "invariant");
1252 assert(!system_gc || explicit_gc, "invariant");
1253 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); 1252 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
1254 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); 1253 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
1255 TraceTime t(system_gc ? "Full GC (System.gc())" : "Full GC", 1254
1256 G1Log::fine(), true, gclog_or_tty); 1255 char verbose_str[128];
1256 sprintf(verbose_str, "Full GC (%s)", GCCause::to_string(gc_cause()));
1257 TraceTime t(verbose_str, G1Log::fine(), true, gclog_or_tty);
1257 1258
1258 TraceCollectorStats tcs(g1mm()->full_collection_counters()); 1259 TraceCollectorStats tcs(g1mm()->full_collection_counters());
1259 TraceMemoryManagerStats tms(true /* fullGC */, gc_cause()); 1260 TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
1260 1261
1261 double start = os::elapsedTime(); 1262 double start = os::elapsedTime();
3586 // the CM thread, the flag's value in the policy has been reset. 3587 // the CM thread, the flag's value in the policy has been reset.
3587 bool should_start_conc_mark = g1_policy()->during_initial_mark_pause(); 3588 bool should_start_conc_mark = g1_policy()->during_initial_mark_pause();
3588 3589
3589 // Inner scope for scope based logging, timers, and stats collection 3590 // Inner scope for scope based logging, timers, and stats collection
3590 { 3591 {
3591 char verbose_str[128];
3592 sprintf(verbose_str, "GC pause ");
3593 if (g1_policy()->gcs_are_young()) {
3594 strcat(verbose_str, "(young)");
3595 } else {
3596 strcat(verbose_str, "(mixed)");
3597 }
3598 if (g1_policy()->during_initial_mark_pause()) { 3592 if (g1_policy()->during_initial_mark_pause()) {
3599 strcat(verbose_str, " (initial-mark)");
3600 // We are about to start a marking cycle, so we increment the 3593 // We are about to start a marking cycle, so we increment the
3601 // full collection counter. 3594 // full collection counter.
3602 increment_total_full_collections(); 3595 increment_total_full_collections();
3603 } 3596 }
3604
3605 // if the log level is "finer" is on, we'll print long statistics information 3597 // if the log level is "finer" is on, we'll print long statistics information
3606 // in the collector policy code, so let's not print this as the output 3598 // in the collector policy code, so let's not print this as the output
3607 // is messy if we do. 3599 // is messy if we do.
3608 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); 3600 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
3609 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); 3601 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
3602
3603 char verbose_str[128];
3604 sprintf(verbose_str, "GC pause (%s) (%s)%s",
3605 GCCause::to_string(gc_cause()),
3606 g1_policy()->gcs_are_young() ? "young" : "mixed",
3607 g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
3610 TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty); 3608 TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
3611 3609
3612 TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); 3610 TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
3613 TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); 3611 TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
3614 3612