< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp
Print this page
rev 54099 : WeakProcessor timings
*** 1,7 ****
/*
! * Copyright (c) 2015, 2018, Red Hat, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
--- 1,7 ----
/*
! * Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
*** 39,57 ****
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/thread.hpp"
#include "services/management.hpp"
ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahHeap* heap, uint n_workers,
ShenandoahPhaseTimings::Phase phase) :
_process_strong_tasks(new SubTasksDone(SHENANDOAH_RP_PS_NumElements)),
_srs(n_workers),
_par_state_string(StringTable::weak_storage()),
_phase(phase),
_coderoots_all_iterator(ShenandoahCodeRoots::iterator()),
! _weak_processor_task(n_workers)
! {
heap->phase_timings()->record_workers_start(_phase);
if (ShenandoahStringDedup::is_enabled()) {
StringDedup::gc_prologue(false);
}
--- 39,77 ----
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/thread.hpp"
#include "services/management.hpp"
+ struct PhaseMap {
+ WeakProcessorPhases::Phase _weak_processor_phase;
+ ShenandoahPhaseTimings::GCParPhases _shenandoah_phase;
+ };
+
+ static const struct PhaseMap phase_mapping[] = {
+ #if INCLUDE_JVMTI
+ {WeakProcessorPhases::jvmti, ShenandoahPhaseTimings::JVMTIWeakRoots},
+ #endif
+ #if INCLUDE_JFR
+ {WeakProcessorPhases::jfr, ShenandoahPhaseTimings::JFRWeakRoots},
+ #endif
+ {WeakProcessorPhases::jni, ShenandoahPhaseTimings::JNIWeakRoots},
+ {WeakProcessorPhases::stringtable, ShenandoahPhaseTimings::StringTableRoots},
+ {WeakProcessorPhases::vm, ShenandoahPhaseTimings::VMWeakRoots}
+ };
+
+ STATIC_ASSERT(sizeof(phase_mapping) / sizeof(PhaseMap) == WeakProcessorPhases::phase_count);
+
ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahHeap* heap, uint n_workers,
ShenandoahPhaseTimings::Phase phase) :
_process_strong_tasks(new SubTasksDone(SHENANDOAH_RP_PS_NumElements)),
_srs(n_workers),
_par_state_string(StringTable::weak_storage()),
_phase(phase),
_coderoots_all_iterator(ShenandoahCodeRoots::iterator()),
! _weak_processor_timings(n_workers),
! _weak_processor_task(&_weak_processor_timings, n_workers),
! _processed_weak_roots(false) {
heap->phase_timings()->record_workers_start(_phase);
if (ShenandoahStringDedup::is_enabled()) {
StringDedup::gc_prologue(false);
}
*** 61,73 ****
--- 81,115 ----
delete _process_strong_tasks;
if (ShenandoahStringDedup::is_enabled()) {
StringDedup::gc_epilogue();
}
+ ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
+
+ if (_processed_weak_roots) {
+ assert(_weak_processor_timings.max_threads() == n_workers(), "Must match");
+ for (uint index = 0; index < WeakProcessorPhases::phase_count; index ++) {
+ WeakProcessorTimingToShenandoahTiming(phase_mapping[index]._weak_processor_phase,
+ phase_mapping[index]._shenandoah_phase,
+ worker_times);
+ }
+ }
+
ShenandoahHeap::heap()->phase_timings()->record_workers_end(_phase);
}
+ void ShenandoahRootProcessor::WeakProcessorTimingToShenandoahTiming(WeakProcessorPhases::Phase wpp, ShenandoahPhaseTimings::GCParPhases spp,
+ ShenandoahWorkerTimings* worker_times) const {
+ if (WeakProcessorPhases::is_serial(wpp)) {
+ worker_times->record_time_secs(spp, 0, _weak_processor_timings.phase_time_sec(wpp));
+ } else {
+ for (uint index = 0; index < _weak_processor_timings.max_threads(); index ++) {
+ worker_times->record_time_secs(spp, index, _weak_processor_timings.worker_time_sec(index, wpp));
+ }
+ }
+ }
+
void ShenandoahRootProcessor::process_all_roots_slow(OopClosure* oops) {
CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
CodeBlobToOopClosure blobs(oops, !CodeBlobToOopClosure::FixRelocations);
CodeCache::blobs_do(&blobs);
*** 191,203 ****
if (_process_strong_tasks->try_claim_task(SHENANDOAH_RP_PS_SystemDictionary_oops_do)) {
ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::SystemDictionaryRoots, worker_id);
SystemDictionary::oops_do(strong_roots);
}
if (jni_weak_roots != NULL) {
- ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIWeakRoots, worker_id);
AlwaysTrueClosure always_true;
_weak_processor_task.work<AlwaysTrueClosure, OopClosure>(worker_id, &always_true, jni_weak_roots);
}
if (ShenandoahStringDedup::is_enabled() && weak_roots != NULL) {
ShenandoahStringDedup::parallel_oops_do(weak_roots, worker_id);
}
--- 233,245 ----
if (_process_strong_tasks->try_claim_task(SHENANDOAH_RP_PS_SystemDictionary_oops_do)) {
ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::SystemDictionaryRoots, worker_id);
SystemDictionary::oops_do(strong_roots);
}
if (jni_weak_roots != NULL) {
AlwaysTrueClosure always_true;
_weak_processor_task.work<AlwaysTrueClosure, OopClosure>(worker_id, &always_true, jni_weak_roots);
+ _processed_weak_roots = true;
}
if (ShenandoahStringDedup::is_enabled() && weak_roots != NULL) {
ShenandoahStringDedup::parallel_oops_do(weak_roots, worker_id);
}
< prev index next >