comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 6064:9d679effd28c

7166894: Add gc cause to GC logging for all collectors Reviewed-by: mgerdin, johnc
author brutisso
date Tue, 15 May 2012 10:25:06 +0200
parents 3a22b77e755a
children 1d478c993020
comparison
equal deleted inserted replaced
6063:cdfa5139bd58 6064:9d679effd28c
1250 // Timing 1250 // Timing
1251 assert(gc_cause() != GCCause::_java_lang_system_gc || explicit_gc, "invariant"); 1251 assert(gc_cause() != GCCause::_java_lang_system_gc || explicit_gc, "invariant");
1252 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); 1252 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
1253 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); 1253 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
1254 1254
1255 char verbose_str[128]; 1255 TraceTime t(GCCauseString("Full GC", gc_cause()), G1Log::fine(), true, gclog_or_tty);
1256 sprintf(verbose_str, "Full GC (%s)", GCCause::to_string(gc_cause()));
1257 TraceTime t(verbose_str, G1Log::fine(), true, gclog_or_tty);
1258
1259 TraceCollectorStats tcs(g1mm()->full_collection_counters()); 1256 TraceCollectorStats tcs(g1mm()->full_collection_counters());
1260 TraceMemoryManagerStats tms(true /* fullGC */, gc_cause()); 1257 TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
1261 1258
1262 double start = os::elapsedTime(); 1259 double start = os::elapsedTime();
1263 g1_policy()->record_full_collection_start(); 1260 g1_policy()->record_full_collection_start();
3598 // in the collector policy code, so let's not print this as the output 3595 // in the collector policy code, so let's not print this as the output
3599 // is messy if we do. 3596 // is messy if we do.
3600 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); 3597 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
3601 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); 3598 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
3602 3599
3603 char verbose_str[128]; 3600 GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause())
3604 sprintf(verbose_str, "GC pause (%s) (%s)%s", 3601 .append(g1_policy()->gcs_are_young() ? " (young)" : " (mixed)")
3605 GCCause::to_string(gc_cause()), 3602 .append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
3606 g1_policy()->gcs_are_young() ? "young" : "mixed", 3603 TraceTime t(gc_cause_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
3607 g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
3608 TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
3609 3604
3610 TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); 3605 TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
3611 TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); 3606 TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
3612 3607
3613 // If the secondary_free_list is not empty, append it to the 3608 // If the secondary_free_list is not empty, append it to the