--- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp Wed Mar 13 17:32:17 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp Wed Mar 13 13:33:50 2019 -0400
@@ -47,7 +47,11 @@
f(scan_code_roots, " S: Code Cache Roots") \
f(scan_universe_roots, " S: Universe Roots") \
f(scan_jni_roots, " S: JNI Roots") \
+ f(scan_jvmti_weak_roots, " S: JVMTI Weak Roots") \
+ f(scan_jfr_weak_roots, " S: JFR Weak Roots") \
f(scan_jni_weak_roots, " S: JNI Weak Roots") \
+ f(scan_stringtable_roots, " S: String Table Roots") \
+ f(scan_vm_weak_roots, " S: VM Weak Roots") \
f(scan_synchronizer_roots, " S: Synchronizer Roots") \
f(scan_management_roots, " S: Management Roots") \
f(scan_system_dictionary_roots, " S: System Dict Roots") \
@@ -68,7 +72,11 @@
f(update_code_roots, " U: Code Cache Roots") \
f(update_universe_roots, " U: Universe Roots") \
f(update_jni_roots, " U: JNI Roots") \
+ f(update_jvmti_weak_roots, " U: JVMTI Weak Roots") \
+ f(update_jfr_weak_roots, " U: JFR Weak Roots") \
f(update_jni_weak_roots, " U: JNI Weak Roots") \
+ f(update_stringtable_roots, " U: String Table Roots") \
+ f(update_vm_weak_roots, " U: VM Weak Roots") \
f(update_synchronizer_roots, " U: Synchronizer Roots") \
f(update_management_roots, " U: Management Roots") \
f(update_system_dictionary_roots, " U: System Dict Roots") \
@@ -97,7 +105,11 @@
f(evac_code_roots, " E: Code Cache Roots") \
f(evac_universe_roots, " E: Universe Roots") \
f(evac_jni_roots, " E: JNI Roots") \
+ f(evac_jvmti_weak_roots, " E: JVMTI Weak Roots") \
+ f(evac_jfr_weak_roots, " E: JFR Weak Roots") \
f(evac_jni_weak_roots, " E: JNI Weak Roots") \
+ f(evac_stringtable_roots, " E: String Table Roots") \
+ f(evac_vm_weak_roots, " E: VM Weak Roots") \
f(evac_synchronizer_roots, " E: Synchronizer Roots") \
f(evac_management_roots, " E: Management Roots") \
f(evac_system_dictionary_roots, " E: System Dict Roots") \
@@ -123,7 +135,11 @@
f(final_update_refs_code_roots, " UR: Code Cache Roots") \
f(final_update_refs_universe_roots, " UR: Universe Roots") \
f(final_update_refs_jni_roots, " UR: JNI Roots") \
- f(final_update_refs_jni_weak_roots, " UR: JNI Weak Roots") \
+ f(final_update_jvmti_weak_roots, " UR: JVMTI Weak Roots") \
+ f(final_update_jfr_weak_roots, " UR: JFR Weak Roots") \
+ f(final_update_jni_weak_roots, " UR: JNI Weak Roots") \
+ f(final_update_stringtable_roots, " UR: String Table Roots") \
+ f(final_update_vm_weak_roots, " UR: VM Weak Roots") \
f(final_update_refs_synchronizer_roots, " UR: Synchronizer Roots") \
f(final_update_refs_management_roots, " UR: Management Roots") \
f(final_update_refs_system_dict_roots, " UR: System Dict Roots") \
@@ -144,7 +160,11 @@
f(degen_gc_update_code_roots, " DU: Code Cache Roots") \
f(degen_gc_update_universe_roots, " DU: Universe Roots") \
f(degen_gc_update_jni_roots, " DU: JNI Roots") \
+ f(degen_gc_update_jvmti_weak_roots, " DU: JVMTI Weak Roots") \
+ f(degen_gc_update_jfr_weak_roots, " DU: JFR Weak Roots") \
f(degen_gc_update_jni_weak_roots, " DU: JNI Weak Roots") \
+ f(degen_gc_update_stringtable_roots, " DU: String Table Roots") \
+ f(degen_gc_update_vm_weak_roots, " DU: VM Weak Roots") \
f(degen_gc_update_synchronizer_roots, " DU: Synchronizer Roots") \
f(degen_gc_update_management_roots, " DU: Management Roots") \
f(degen_gc_update_system_dict_roots, " DU: System Dict Roots") \
@@ -166,7 +186,11 @@
f(init_traversal_gc_code_roots, " TI: Code Cache Roots") \
f(init_traversal_gc_universe_roots, " TI: Universe Roots") \
f(init_traversal_gc_jni_roots, " TI: JNI Roots") \
+ f(init_traversal_gc_jvmti_weak_roots, " TI: JVMTI Weak Roots") \
+ f(init_traversal_gc_jfr_weak_roots, " TI: JFR Weak Roots") \
f(init_traversal_gc_jni_weak_roots, " TI: JNI Weak Roots") \
+ f(init_traversal_gc_stringtable_roots, " TI: String Table Roots") \
+ f(init_traversal_gc_vm_weak_roots, " TI: VM Weak Roots") \
f(init_traversal_gc_synchronizer_roots, " TI: Synchronizer Roots") \
f(init_traversal_gc_management_roots, " TI: Management Roots") \
f(init_traversal_gc_system_dict_roots, " TI: System Dict Roots") \
@@ -185,7 +209,11 @@
f(final_traversal_gc_code_roots, " TF: Code Cache Roots") \
f(final_traversal_gc_universe_roots, " TF: Universe Roots") \
f(final_traversal_gc_jni_roots, " TF: JNI Roots") \
+ f(final_traversal_gc_jvmti_weak_roots, " TF: JVMTI Weak Roots") \
+ f(final_traversal_gc_jfr_weak_roots, " TF: JFR Weak Roots") \
f(final_traversal_gc_jni_weak_roots, " TF: JNI Weak Roots") \
+ f(final_traversal_gc_stringtable_roots, " TF: String Table Roots") \
+ f(final_traversal_gc_vm_weak_roots, " TF: VM Weak Roots") \
f(final_traversal_gc_synchronizer_roots, " TF: Synchronizer Roots") \
f(final_traversal_gc_management_roots, " TF: Management Roots") \
f(final_traversal_gc_system_dict_roots, " TF: System Dict Roots") \
@@ -202,7 +230,11 @@
f(final_traversal_update_code_roots, " TU: Code Cache Roots") \
f(final_traversal_update_universe_roots, " TU: Universe Roots") \
f(final_traversal_update_jni_roots, " TU: JNI Roots") \
+ f(final_traversal_update_jvmti_weak_roots, " TU: JVMTI Weak Roots") \
+ f(final_traversal_update_jfr_weak_roots, " TU: JFR Weak Roots") \
f(final_traversal_update_jni_weak_roots, " TU: JNI Weak Roots") \
+ f(final_traversal_update_stringtable_roots, " TU: String Table Roots") \
+ f(final_traversal_update_vm_weak_roots, " TU: VM Weak Roots") \
f(final_traversal_update_synchronizer_roots, " TU: Synchronizer Roots") \
f(final_traversal_update_management_roots, " TU: Management Roots") \
f(final_traversal_update_system_dict_roots, " TU: System Dict Roots") \
@@ -225,7 +257,11 @@
f(full_gc_code_roots, " F: Code Cache Roots") \
f(full_gc_universe_roots, " F: Universe Roots") \
f(full_gc_jni_roots, " F: JNI Roots") \
+ f(full_gc_jvmti_weak_roots, " F: JVMTI Weak Roots") \
+ f(full_gc_jfr_weak_roots, " F: JFR Weak Roots") \
f(full_gc_jni_weak_roots, " F: JNI Weak Roots") \
+ f(full_gc_stringtable_roots, " F: String Table Roots") \
+ f(full_gc_vm_weak_roots, " F: VM Weak Roots") \
f(full_gc_synchronizer_roots, " F: Synchronizer Roots") \
f(full_gc_management_roots, " F: Management Roots") \
f(full_gc_system_dictionary_roots, " F: System Dict Roots") \
@@ -279,7 +315,11 @@
f(CodeCacheRoots, "CodeCache Roots (ms):") \
f(UniverseRoots, "Universe Roots (ms):") \
f(JNIRoots, "JNI Handles Roots (ms):") \
+ f(JVMTIWeakRoots, "JVMTI Weak Roots (ms):") \
+ f(JFRWeakRoots, "JFR Weak Roots (ms):") \
f(JNIWeakRoots, "JNI Weak Roots (ms):") \
+ f(StringTableRoots, "StringTable Roots(ms):") \
+ f(VMWeakRoots, "VM Weak Roots(ms)") \
f(ObjectSynchronizerRoots, "ObjectSynchronizer Roots (ms):") \
f(ManagementRoots, "Management Roots (ms):") \
f(SystemDictionaryRoots, "SystemDictionary Roots (ms):") \
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp Wed Mar 13 17:32:17 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp Wed Mar 13 13:33:50 2019 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, Red Hat, Inc. All rights reserved.
+ * 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
@@ -41,6 +41,25 @@
#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)),
@@ -48,8 +67,9 @@
_par_state_string(StringTable::weak_storage()),
_phase(phase),
_coderoots_all_iterator(ShenandoahCodeRoots::iterator()),
- _weak_processor_task(n_workers)
-{
+ _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()) {
@@ -63,9 +83,32 @@
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 ++) {
+ weak_processor_timing_to_shenandoah_timing(phase_mapping[index]._weak_processor_phase,
+ phase_mapping[index]._shenandoah_phase,
+ worker_times);
+ }
+ }
+
ShenandoahHeap::heap()->phase_timings()->record_workers_end(_phase);
}
+void ShenandoahRootProcessor::weak_processor_timing_to_shenandoah_timing(const WeakProcessorPhases::Phase wpp,
+ const 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);
@@ -193,9 +236,9 @@
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);
+ 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) {