Skip to content
Permalink
Browse files
8260998: Shenandoah: Restore reference processing statistics reporting
Reviewed-by: shade
  • Loading branch information
zhengyu123 committed Feb 3, 2021
1 parent c8de943 commit 5324b5c582325b1703000fc9dbf8a2a1002bd2fc
@@ -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();
}
@@ -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]);
}

@@ -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"

@@ -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;
@@ -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();
@@ -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;
@@ -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);

0 comments on commit 5324b5c

Please sign in to comment.