comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 6007:5c86f8211d1e

7160728: Introduce an extra logging level for G1 logging Summary: Added log levels "fine", "finer" and "finest". Let PrintGC map to "fine" and PrintGCDetails map to "finer". Separated out the per worker information in the G1 logging to the "finest" level. Reviewed-by: stefank, jwilhelm, tonyp, johnc
author brutisso
date Fri, 13 Apr 2012 01:59:38 +0200
parents 748051fd24ce
children b632e80fc9dc
comparison
equal deleted inserted replaced
5994:4a32c51458b9 6007:5c86f8211d1e
31 #include "gc_implementation/g1/g1AllocRegion.inline.hpp" 31 #include "gc_implementation/g1/g1AllocRegion.inline.hpp"
32 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 32 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
33 #include "gc_implementation/g1/g1CollectorPolicy.hpp" 33 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
34 #include "gc_implementation/g1/g1ErgoVerbose.hpp" 34 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
35 #include "gc_implementation/g1/g1EvacFailure.hpp" 35 #include "gc_implementation/g1/g1EvacFailure.hpp"
36 #include "gc_implementation/g1/g1Log.hpp"
36 #include "gc_implementation/g1/g1MarkSweep.hpp" 37 #include "gc_implementation/g1/g1MarkSweep.hpp"
37 #include "gc_implementation/g1/g1OopClosures.inline.hpp" 38 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
38 #include "gc_implementation/g1/g1RemSet.inline.hpp" 39 #include "gc_implementation/g1/g1RemSet.inline.hpp"
39 #include "gc_implementation/g1/heapRegion.inline.hpp" 40 #include "gc_implementation/g1/heapRegion.inline.hpp"
40 #include "gc_implementation/g1/heapRegionRemSet.hpp" 41 #include "gc_implementation/g1/heapRegionRemSet.hpp"
1253 IsGCActiveMark x; 1254 IsGCActiveMark x;
1254 1255
1255 // Timing 1256 // Timing
1256 bool system_gc = (gc_cause() == GCCause::_java_lang_system_gc); 1257 bool system_gc = (gc_cause() == GCCause::_java_lang_system_gc);
1257 assert(!system_gc || explicit_gc, "invariant"); 1258 assert(!system_gc || explicit_gc, "invariant");
1258 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); 1259 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
1259 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); 1260 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
1260 TraceTime t(system_gc ? "Full GC (System.gc())" : "Full GC", 1261 TraceTime t(system_gc ? "Full GC (System.gc())" : "Full GC",
1261 PrintGC, true, gclog_or_tty); 1262 G1Log::fine(), true, gclog_or_tty);
1262 1263
1263 TraceCollectorStats tcs(g1mm()->full_collection_counters()); 1264 TraceCollectorStats tcs(g1mm()->full_collection_counters());
1264 TraceMemoryManagerStats tms(true /* fullGC */, gc_cause()); 1265 TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
1265 1266
1266 double start = os::elapsedTime(); 1267 double start = os::elapsedTime();
1442 } else { 1443 } else {
1443 RebuildRSOutOfRegionClosure rebuild_rs(this); 1444 RebuildRSOutOfRegionClosure rebuild_rs(this);
1444 heap_region_iterate(&rebuild_rs); 1445 heap_region_iterate(&rebuild_rs);
1445 } 1446 }
1446 1447
1447 if (PrintGC) { 1448 if (G1Log::fine()) {
1448 print_size_transition(gclog_or_tty, g1h_prev_used, used(), capacity()); 1449 print_size_transition(gclog_or_tty, g1h_prev_used, used(), capacity());
1449 } 1450 }
1450 1451
1451 if (true) { // FIXME 1452 if (true) { // FIXME
1452 // Ask the permanent generation to adjust size for full collections 1453 // Ask the permanent generation to adjust size for full collections
1915 1916
1916 jint G1CollectedHeap::initialize() { 1917 jint G1CollectedHeap::initialize() {
1917 CollectedHeap::pre_initialize(); 1918 CollectedHeap::pre_initialize();
1918 os::enable_vtime(); 1919 os::enable_vtime();
1919 1920
1921 G1Log::init();
1922
1920 // Necessary to satisfy locking discipline assertions. 1923 // Necessary to satisfy locking discipline assertions.
1921 1924
1922 MutexLocker x(Heap_lock); 1925 MutexLocker x(Heap_lock);
1923 1926
1924 // We have to initialize the printer before committing the heap, as 1927 // We have to initialize the printer before committing the heap, as
3607 // We are about to start a marking cycle, so we increment the 3610 // We are about to start a marking cycle, so we increment the
3608 // full collection counter. 3611 // full collection counter.
3609 increment_total_full_collections(); 3612 increment_total_full_collections();
3610 } 3613 }
3611 3614
3612 // if PrintGCDetails is on, we'll print long statistics information 3615 // if the log level is "finer" is on, we'll print long statistics information
3613 // in the collector policy code, so let's not print this as the output 3616 // in the collector policy code, so let's not print this as the output
3614 // is messy if we do. 3617 // is messy if we do.
3615 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); 3618 gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
3616 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); 3619 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
3617 TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty); 3620 TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
3618 3621
3619 TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); 3622 TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
3620 TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); 3623 TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
3621 3624
3622 // If the secondary_free_list is not empty, append it to the 3625 // If the secondary_free_list is not empty, append it to the
3929 vm_exit(-1); 3932 vm_exit(-1);
3930 } 3933 }
3931 } 3934 }
3932 3935
3933 // The closing of the inner scope, immediately above, will complete 3936 // The closing of the inner scope, immediately above, will complete
3934 // the PrintGC logging output. The record_collection_pause_end() call 3937 // logging at the "fine" level. The record_collection_pause_end() call
3935 // above will complete the logging output of PrintGCDetails. 3938 // above will complete logging at the "finer" level.
3936 // 3939 //
3937 // It is not yet to safe, however, to tell the concurrent mark to 3940 // It is not yet to safe, however, to tell the concurrent mark to
3938 // start as we have some optional output below. We don't want the 3941 // start as we have some optional output below. We don't want the
3939 // output from the concurrent mark thread interfering with this 3942 // output from the concurrent mark thread interfering with this
3940 // logging output either. 3943 // logging output either.
5512 5515
5513 finalize_for_evac_failure(); 5516 finalize_for_evac_failure();
5514 5517
5515 if (evacuation_failed()) { 5518 if (evacuation_failed()) {
5516 remove_self_forwarding_pointers(); 5519 remove_self_forwarding_pointers();
5517 if (PrintGCDetails) { 5520 if (G1Log::finer()) {
5518 gclog_or_tty->print(" (to-space overflow)"); 5521 gclog_or_tty->print(" (to-space overflow)");
5519 } else if (PrintGC) { 5522 } else if (G1Log::fine()) {
5520 gclog_or_tty->print("--"); 5523 gclog_or_tty->print("--");
5521 } 5524 }
5522 } 5525 }
5523 5526
5524 // Enqueue any remaining references remaining on the STW 5527 // Enqueue any remaining references remaining on the STW