Skip to content

Commit

Permalink
8260998: Shenandoah: Restore reference processing statistics reporting
Browse files Browse the repository at this point in the history
Reviewed-by: shade
  • Loading branch information
zhengyu123 committed Feb 3, 2021
1 parent c8de943 commit 5324b5c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ ShenandoahReferenceProcessor::ShenandoahReferenceProcessor(uint max_workers) :
_ref_proc_thread_locals(NEW_C_HEAP_ARRAY(ShenandoahRefProcThreadLocal, max_workers, mtGC)),
_pending_list(NULL),
_pending_list_tail(&_pending_list),
_iterate_discovered_list_id(0U) {
_iterate_discovered_list_id(0U),
_stats() {
for (size_t i = 0; i < max_workers; i++) {
_ref_proc_thread_locals[i].reset();
}
Expand Down Expand Up @@ -595,10 +596,17 @@ void ShenandoahReferenceProcessor::collect_statistics() {
enqueued[type] += _ref_proc_thread_locals[i].enqueued((ReferenceType)type);
}
}

_stats = ReferenceProcessorStats(discovered[REF_SOFT],
discovered[REF_WEAK],
discovered[REF_FINAL],
discovered[REF_PHANTOM]);

log_info(gc,ref)("Encountered references: Soft: " SIZE_FORMAT ", Weak: " SIZE_FORMAT ", Final: " SIZE_FORMAT ", Phantom: " SIZE_FORMAT,
encountered[REF_SOFT], encountered[REF_WEAK], encountered[REF_FINAL], encountered[REF_PHANTOM]);
log_info(gc,ref)("Discovered references: Soft: " SIZE_FORMAT ", Weak: " SIZE_FORMAT ", Final: " SIZE_FORMAT ", Phantom: " SIZE_FORMAT,
discovered[REF_SOFT], discovered[REF_WEAK], discovered[REF_FINAL], discovered[REF_PHANTOM]);
log_info(gc,ref)("Enqueued references: Soft: " SIZE_FORMAT ", Weak: " SIZE_FORMAT ", Final: " SIZE_FORMAT ", Phantom: " SIZE_FORMAT,
enqueued[REF_SOFT], enqueued[REF_WEAK], enqueued[REF_FINAL], enqueued[REF_PHANTOM]);
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#define SHARE_VM_GC_SHENANDOAH_SHENANDOAHREFERENCEPROCESSOR_HPP

#include "gc/shared/referenceDiscoverer.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/referenceProcessorStats.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
#include "memory/allocation.hpp"

Expand Down Expand Up @@ -136,6 +138,8 @@ class ShenandoahReferenceProcessor : public ReferenceDiscoverer {

volatile uint _iterate_discovered_list_id;

ReferenceProcessorStats _stats;

template <typename T>
bool is_inactive(oop reference, oop referent, ReferenceType type) const;
bool is_strongly_live(oop referent) const;
Expand Down Expand Up @@ -179,6 +183,8 @@ class ShenandoahReferenceProcessor : public ReferenceDiscoverer {

void process_references(ShenandoahPhaseTimings::Phase phase, WorkGang* workers, bool concurrent);

const ReferenceProcessorStats& reference_process_stats() { return _stats; }

void work();

void abandon_partial_discovery();
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
#include "gc/shared/gcCause.hpp"
#include "gc/shared/gcTrace.hpp"
#include "gc/shared/gcWhen.hpp"
#include "gc/shared/referenceProcessorStats.hpp"
#include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp"
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp"
#include "utilities/debug.hpp"

ShenandoahPhaseTimings::Phase ShenandoahTimingsTracker::_current_phase = ShenandoahPhaseTimings::_invalid_phase;
Expand Down Expand Up @@ -65,6 +67,7 @@ ShenandoahGCSession::~ShenandoahGCSession() {
_heap->heuristics()->record_cycle_end();
_timer->register_gc_end();
_heap->trace_heap_after_gc(_tracer);
_tracer->report_gc_reference_stats(_heap->ref_processor()->reference_process_stats());
_tracer->report_gc_end(_timer->gc_end(), _timer->time_partitions());
assert(!ShenandoahGCPhase::is_current_phase_valid(), "No current GC phase");
_heap->set_gc_cause(GCCause::_no_gc);
Expand Down

0 comments on commit 5324b5c

Please sign in to comment.