7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions

It introduces ergonomic decision logging in G1 for the following heuristics: heap sizing, collection set construction, concurrent cycle initiation, and partially-young GC start/end. The code has a bit of refactoring in a few places to make the decision logging possible. It also replaces alternative ad-hoc logging that we have under different parameters and switches (G1_DEBUG, G1PolicyVerbose).

Reviewed-by: johnc, ysr
This commit is contained in:
Antonios Printezis 2011-09-07 12:21:23 -04:00
parent a9cd50a1c8
commit 24eb07061e
9 changed files with 563 additions and 207 deletions

View file

@ -28,6 +28,7 @@
#include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1CollectorPolicy.hpp"
#include "gc_implementation/g1/g1ErgoVerbose.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
@ -1727,18 +1728,21 @@ void ConcurrentMark::cleanup() {
size_t known_garbage_bytes =
g1_par_count_task.used_bytes() - g1_par_count_task.live_bytes();
#if 0
gclog_or_tty->print_cr("used %1.2lf, live %1.2lf, garbage %1.2lf",
(double) g1_par_count_task.used_bytes() / (double) (1024 * 1024),
(double) g1_par_count_task.live_bytes() / (double) (1024 * 1024),
(double) known_garbage_bytes / (double) (1024 * 1024));
#endif // 0
g1p->set_known_garbage_bytes(known_garbage_bytes);
size_t start_used_bytes = g1h->used();
_at_least_one_mark_complete = true;
g1h->set_marking_complete();
ergo_verbose4(ErgoConcCycles,
"finish cleanup",
ergo_format_byte("occupancy")
ergo_format_byte("capacity")
ergo_format_byte_perc("known garbage"),
start_used_bytes, g1h->capacity(),
known_garbage_bytes,
((double) known_garbage_bytes / (double) g1h->capacity()) * 100.0);
double count_end = os::elapsedTime();
double this_final_counting_time = (count_end - start);
if (G1PrintParCleanupStats) {