8278581: Improve reference processing statistics log output
Reviewed-by: tschatzl, kbarrett, sjohanss
This commit is contained in:
parent
bd339aa6c0
commit
4f0b65023f
@ -483,7 +483,7 @@ void RefProcTask::process_discovered_list(uint worker_id,
|
|||||||
keep_alive,
|
keep_alive,
|
||||||
enqueue,
|
enqueue,
|
||||||
do_enqueue_and_clear);
|
do_enqueue_and_clear);
|
||||||
_phase_times->add_ref_cleared(ref_type, removed);
|
_phase_times->add_ref_dropped(ref_type, removed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void ReferenceProcessorPhaseTimes::reset() {
|
|||||||
_soft_weak_final_refs_phase_worker_time_sec->reset();
|
_soft_weak_final_refs_phase_worker_time_sec->reset();
|
||||||
|
|
||||||
for (int i = 0; i < number_of_subclasses_of_ref; i++) {
|
for (int i = 0; i < number_of_subclasses_of_ref; i++) {
|
||||||
_ref_cleared[i] = 0;
|
_ref_dropped[i] = 0;
|
||||||
_ref_discovered[i] = 0;
|
_ref_discovered[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,9 +213,9 @@ ReferenceProcessorPhaseTimes::~ReferenceProcessorPhaseTimes() {
|
|||||||
delete _soft_weak_final_refs_phase_worker_time_sec;
|
delete _soft_weak_final_refs_phase_worker_time_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReferenceProcessorPhaseTimes::add_ref_cleared(ReferenceType ref_type, size_t count) {
|
void ReferenceProcessorPhaseTimes::add_ref_dropped(ReferenceType ref_type, size_t count) {
|
||||||
ASSERT_REF_TYPE(ref_type);
|
ASSERT_REF_TYPE(ref_type);
|
||||||
Atomic::add(&_ref_cleared[ref_type_2_index(ref_type)], count, memory_order_relaxed);
|
Atomic::add(&_ref_dropped[ref_type_2_index(ref_type)], count, memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReferenceProcessorPhaseTimes::set_ref_discovered(ReferenceType ref_type, size_t count) {
|
void ReferenceProcessorPhaseTimes::set_ref_discovered(ReferenceType ref_type, size_t count) {
|
||||||
@ -270,13 +270,16 @@ void ReferenceProcessorPhaseTimes::print_reference(ReferenceType ref_type, uint
|
|||||||
LogStream ls(lt);
|
LogStream ls(lt);
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
|
|
||||||
ls.print_cr("%s%s:", Indents[base_indent], ref_type_2_string(ref_type));
|
|
||||||
|
|
||||||
uint const next_indent = base_indent + 1;
|
|
||||||
int const ref_type_index = ref_type_2_index(ref_type);
|
int const ref_type_index = ref_type_2_index(ref_type);
|
||||||
|
|
||||||
ls.print_cr("%sDiscovered: " SIZE_FORMAT, Indents[next_indent], _ref_discovered[ref_type_index]);
|
size_t discovered = _ref_discovered[ref_type_index];
|
||||||
ls.print_cr("%sCleared: " SIZE_FORMAT, Indents[next_indent], _ref_cleared[ref_type_index]);
|
size_t dropped = _ref_dropped[ref_type_index];
|
||||||
|
assert(discovered >= dropped, "invariant");
|
||||||
|
size_t processed = discovered - dropped;
|
||||||
|
|
||||||
|
ls.print_cr("%s%s Discovered: %zu, Dropped: %zu, Processed: %zu",
|
||||||
|
Indents[base_indent], ref_type_2_string(ref_type),
|
||||||
|
discovered, dropped, processed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class ReferenceProcessorPhaseTimes : public CHeapObj<mtGC> {
|
|||||||
// Total spent time for reference processing.
|
// Total spent time for reference processing.
|
||||||
double _total_time_ms;
|
double _total_time_ms;
|
||||||
|
|
||||||
size_t _ref_cleared[number_of_subclasses_of_ref];
|
size_t _ref_dropped[number_of_subclasses_of_ref];
|
||||||
size_t _ref_discovered[number_of_subclasses_of_ref];
|
size_t _ref_discovered[number_of_subclasses_of_ref];
|
||||||
|
|
||||||
bool _processing_is_mt;
|
bool _processing_is_mt;
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
void set_total_time_ms(double total_time_ms) { _total_time_ms = total_time_ms; }
|
void set_total_time_ms(double total_time_ms) { _total_time_ms = total_time_ms; }
|
||||||
|
|
||||||
void add_ref_cleared(ReferenceType ref_type, size_t count);
|
void add_ref_dropped(ReferenceType ref_type, size_t count);
|
||||||
void set_ref_discovered(ReferenceType ref_type, size_t count);
|
void set_ref_discovered(ReferenceType ref_type, size_t count);
|
||||||
size_t ref_discovered(ReferenceType ref_type);
|
size_t ref_discovered(ReferenceType ref_type);
|
||||||
|
|
||||||
|
@ -80,9 +80,11 @@ public class TestPrintReferences {
|
|||||||
|
|
||||||
private static String refRegex(String reftype) {
|
private static String refRegex(String reftype) {
|
||||||
String countRegex = "[0-9]+";
|
String countRegex = "[0-9]+";
|
||||||
return gcLogTimeRegex + indent(6) + reftype + ":\n" +
|
return gcLogTimeRegex + indent(6) + reftype + " " +
|
||||||
gcLogTimeRegex + indent(8) + "Discovered: " + countRegex + "\n" +
|
"Discovered: " + countRegex + ", " +
|
||||||
gcLogTimeRegex + indent(8) + "Cleared: " + countRegex + "\n";
|
"Dropped: " + countRegex + ", " +
|
||||||
|
"Processed: " + countRegex + "\n"
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkRefsLogFormat(OutputAnalyzer output) {
|
private static void checkRefsLogFormat(OutputAnalyzer output) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user