Skip to content

Commit

Permalink
Adding additional logging, removing 'static'
Browse files Browse the repository at this point in the history
  • Loading branch information
satyenme committed Sep 3, 2024
1 parent 1fc6ef0 commit f087964
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
36 changes: 30 additions & 6 deletions src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void ShenandoahConcurrentGC::entry_final_updaterefs() {
}

void ShenandoahConcurrentGC::entry_final_roots() {
static const char* msg = final_roots_event_message();
const char* msg = final_roots_event_message();
ShenandoahPausePhase gc_phase(msg, ShenandoahPhaseTimings::final_roots);
EventMark em("%s", msg);

Expand All @@ -339,7 +339,7 @@ void ShenandoahConcurrentGC::entry_reset() {

TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
{
static const char* msg = conc_reset_event_message();
const char* msg = conc_reset_event_message();
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_reset);
EventMark em("%s", msg);

Expand Down Expand Up @@ -424,7 +424,7 @@ void ShenandoahConcurrentGC::entry_thread_roots() {

void ShenandoahConcurrentGC::entry_weak_refs() {
ShenandoahHeap* const heap = ShenandoahHeap::heap();
static const char* msg = "Concurrent weak references";
const char* msg = conc_weak_refs_event_message();
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_weak_refs);
EventMark em("%s", msg);

Expand All @@ -439,7 +439,7 @@ void ShenandoahConcurrentGC::entry_weak_refs() {
void ShenandoahConcurrentGC::entry_weak_roots() {
ShenandoahHeap* const heap = ShenandoahHeap::heap();
TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
static const char* msg = "Concurrent weak roots";
const char* msg = conc_weak_roots_event_message();
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_weak_roots);
EventMark em("%s", msg);

Expand Down Expand Up @@ -486,7 +486,7 @@ void ShenandoahConcurrentGC::entry_strong_roots() {
void ShenandoahConcurrentGC::entry_cleanup_early() {
ShenandoahHeap* const heap = ShenandoahHeap::heap();
TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
static const char* msg = "Concurrent cleanup";
const char* msg = conc_cleanup_event_message();
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_cleanup_early, true /* log_heap_usage */);
EventMark em("%s", msg);

Expand Down Expand Up @@ -542,7 +542,7 @@ void ShenandoahConcurrentGC::entry_updaterefs() {
void ShenandoahConcurrentGC::entry_cleanup_complete() {
ShenandoahHeap* const heap = ShenandoahHeap::heap();
TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
static const char* msg = "Concurrent cleanup";
const char* msg = conc_cleanup_event_message();
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_cleanup_complete, true /* log_heap_usage */);
EventMark em("%s", msg);

Expand Down Expand Up @@ -1246,3 +1246,27 @@ const char* ShenandoahConcurrentGC::final_roots_event_message() const {
SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Pause Final Roots", "");
}
}

const char* ShenandoahConcurrentGC::conc_weak_refs_event_message() const {
if (ShenandoahHeap::heap()->unload_classes()) {
SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Concurrent weak references", " (unload classes)");
} else {
SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Concurrent weak references", "");
}
}

const char* ShenandoahConcurrentGC::conc_weak_roots_event_message() const {
if (ShenandoahHeap::heap()->unload_classes()) {
SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Concurrent weak roots", " (unload classes)");
} else {
SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Concurrent weak roots", "");
}
}

const char* ShenandoahConcurrentGC::conc_cleanup_event_message() const {
if (ShenandoahHeap::heap()->unload_classes()) {
SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Concurrent cleanup", " (unload classes)");
} else {
SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Concurrent cleanup", "");
}
}
3 changes: 3 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class ShenandoahConcurrentGC : public ShenandoahGC {
const char* final_roots_event_message() const;
const char* conc_mark_event_message() const;
const char* conc_reset_event_message() const;
const char* conc_weak_refs_event_message() const;
const char* conc_weak_roots_event_message() const;
const char* conc_cleanup_event_message() const;

protected:
// Check GC cancellation and abort concurrent GC
Expand Down

0 comments on commit f087964

Please sign in to comment.