mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8005849: JEP 167: Event-Based JVM Tracing
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com> Co-authored-by: Bengt Rutisson <bengt.rutisson@oracle.com> Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com> Co-authored-by: Erik Gahlin <erik.gahlin@oracle.com> Co-authored-by: Erik Helin <erik.helin@oracle.com> Co-authored-by: Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com> Co-authored-by: Keith McGuigan <keith.mcguigan@oracle.com> Co-authored-by: Mattias Tobiasson <mattias.tobiasson@oracle.com> Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com> Co-authored-by: Mikael Auno <mikael.auno@oracle.com> Co-authored-by: Nils Eliasson <nils.eliasson@oracle.com> Co-authored-by: Nils Loodin <nils.loodin@oracle.com> Co-authored-by: Rickard Backman <rickard.backman@oracle.com> Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com> Co-authored-by: Yekaterina Kantserova <yekaterina.kantserova@oracle.com> Reviewed-by: acorn, coleenp, sla
This commit is contained in:
parent
6b2c468c35
commit
718f3252f6
195 changed files with 7628 additions and 1484 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,6 +25,8 @@
|
|||
#include "precompiled.hpp"
|
||||
#include "classfile/javaClasses.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "gc_implementation/shared/gcTimer.hpp"
|
||||
#include "gc_implementation/shared/gcTraceTime.hpp"
|
||||
#include "gc_interface/collectedHeap.hpp"
|
||||
#include "gc_interface/collectedHeap.inline.hpp"
|
||||
#include "memory/referencePolicy.hpp"
|
||||
|
@ -180,11 +182,20 @@ void ReferenceProcessor::update_soft_ref_master_clock() {
|
|||
// past clock value.
|
||||
}
|
||||
|
||||
void ReferenceProcessor::process_discovered_references(
|
||||
size_t ReferenceProcessor::total_count(DiscoveredList lists[]) {
|
||||
size_t total = 0;
|
||||
for (uint i = 0; i < _max_num_q; ++i) {
|
||||
total += lists[i].length();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
ReferenceProcessorStats ReferenceProcessor::process_discovered_references(
|
||||
BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive,
|
||||
VoidClosure* complete_gc,
|
||||
AbstractRefProcTaskExecutor* task_executor) {
|
||||
AbstractRefProcTaskExecutor* task_executor,
|
||||
GCTimer* gc_timer) {
|
||||
NOT_PRODUCT(verify_ok_to_handle_reflists());
|
||||
|
||||
assert(!enqueuing_is_done(), "If here enqueuing should not be complete");
|
||||
|
@ -202,34 +213,43 @@ void ReferenceProcessor::process_discovered_references(
|
|||
_soft_ref_timestamp_clock = java_lang_ref_SoftReference::clock();
|
||||
|
||||
bool trace_time = PrintGCDetails && PrintReferenceGC;
|
||||
|
||||
// Soft references
|
||||
size_t soft_count = 0;
|
||||
{
|
||||
TraceTime tt("SoftReference", trace_time, false, gclog_or_tty);
|
||||
process_discovered_reflist(_discoveredSoftRefs, _current_soft_ref_policy, true,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
GCTraceTime tt("SoftReference", trace_time, false, gc_timer);
|
||||
soft_count =
|
||||
process_discovered_reflist(_discoveredSoftRefs, _current_soft_ref_policy, true,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
}
|
||||
|
||||
update_soft_ref_master_clock();
|
||||
|
||||
// Weak references
|
||||
size_t weak_count = 0;
|
||||
{
|
||||
TraceTime tt("WeakReference", trace_time, false, gclog_or_tty);
|
||||
process_discovered_reflist(_discoveredWeakRefs, NULL, true,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
GCTraceTime tt("WeakReference", trace_time, false, gc_timer);
|
||||
weak_count =
|
||||
process_discovered_reflist(_discoveredWeakRefs, NULL, true,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
}
|
||||
|
||||
// Final references
|
||||
size_t final_count = 0;
|
||||
{
|
||||
TraceTime tt("FinalReference", trace_time, false, gclog_or_tty);
|
||||
process_discovered_reflist(_discoveredFinalRefs, NULL, false,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
GCTraceTime tt("FinalReference", trace_time, false, gc_timer);
|
||||
final_count =
|
||||
process_discovered_reflist(_discoveredFinalRefs, NULL, false,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
}
|
||||
|
||||
// Phantom references
|
||||
size_t phantom_count = 0;
|
||||
{
|
||||
TraceTime tt("PhantomReference", trace_time, false, gclog_or_tty);
|
||||
process_discovered_reflist(_discoveredPhantomRefs, NULL, false,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
GCTraceTime tt("PhantomReference", trace_time, false, gc_timer);
|
||||
phantom_count =
|
||||
process_discovered_reflist(_discoveredPhantomRefs, NULL, false,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
}
|
||||
|
||||
// Weak global JNI references. It would make more sense (semantically) to
|
||||
|
@ -238,12 +258,14 @@ void ReferenceProcessor::process_discovered_references(
|
|||
// thus use JNI weak references to circumvent the phantom references and
|
||||
// resurrect a "post-mortem" object.
|
||||
{
|
||||
TraceTime tt("JNI Weak Reference", trace_time, false, gclog_or_tty);
|
||||
GCTraceTime tt("JNI Weak Reference", trace_time, false, gc_timer);
|
||||
if (task_executor != NULL) {
|
||||
task_executor->set_single_threaded_mode();
|
||||
}
|
||||
process_phaseJNI(is_alive, keep_alive, complete_gc);
|
||||
}
|
||||
|
||||
return ReferenceProcessorStats(soft_count, weak_count, final_count, phantom_count);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
@ -878,7 +900,7 @@ void ReferenceProcessor::balance_all_queues() {
|
|||
balance_queues(_discoveredPhantomRefs);
|
||||
}
|
||||
|
||||
void
|
||||
size_t
|
||||
ReferenceProcessor::process_discovered_reflist(
|
||||
DiscoveredList refs_lists[],
|
||||
ReferencePolicy* policy,
|
||||
|
@ -901,12 +923,11 @@ ReferenceProcessor::process_discovered_reflist(
|
|||
must_balance) {
|
||||
balance_queues(refs_lists);
|
||||
}
|
||||
|
||||
size_t total_list_count = total_count(refs_lists);
|
||||
|
||||
if (PrintReferenceGC && PrintGCDetails) {
|
||||
size_t total = 0;
|
||||
for (uint i = 0; i < _max_num_q; ++i) {
|
||||
total += refs_lists[i].length();
|
||||
}
|
||||
gclog_or_tty->print(", %u refs", total);
|
||||
gclog_or_tty->print(", %u refs", total_list_count);
|
||||
}
|
||||
|
||||
// Phase 1 (soft refs only):
|
||||
|
@ -951,6 +972,8 @@ ReferenceProcessor::process_discovered_reflist(
|
|||
is_alive, keep_alive, complete_gc);
|
||||
}
|
||||
}
|
||||
|
||||
return total_list_count;
|
||||
}
|
||||
|
||||
void ReferenceProcessor::clean_up_discovered_references() {
|
||||
|
@ -1266,14 +1289,15 @@ void ReferenceProcessor::preclean_discovered_references(
|
|||
BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive,
|
||||
VoidClosure* complete_gc,
|
||||
YieldClosure* yield) {
|
||||
YieldClosure* yield,
|
||||
GCTimer* gc_timer) {
|
||||
|
||||
NOT_PRODUCT(verify_ok_to_handle_reflists());
|
||||
|
||||
// Soft references
|
||||
{
|
||||
TraceTime tt("Preclean SoftReferences", PrintGCDetails && PrintReferenceGC,
|
||||
false, gclog_or_tty);
|
||||
GCTraceTime tt("Preclean SoftReferences", PrintGCDetails && PrintReferenceGC,
|
||||
false, gc_timer);
|
||||
for (uint i = 0; i < _max_num_q; i++) {
|
||||
if (yield->should_return()) {
|
||||
return;
|
||||
|
@ -1285,8 +1309,8 @@ void ReferenceProcessor::preclean_discovered_references(
|
|||
|
||||
// Weak references
|
||||
{
|
||||
TraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC,
|
||||
false, gclog_or_tty);
|
||||
GCTraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC,
|
||||
false, gc_timer);
|
||||
for (uint i = 0; i < _max_num_q; i++) {
|
||||
if (yield->should_return()) {
|
||||
return;
|
||||
|
@ -1298,8 +1322,8 @@ void ReferenceProcessor::preclean_discovered_references(
|
|||
|
||||
// Final references
|
||||
{
|
||||
TraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC,
|
||||
false, gclog_or_tty);
|
||||
GCTraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC,
|
||||
false, gc_timer);
|
||||
for (uint i = 0; i < _max_num_q; i++) {
|
||||
if (yield->should_return()) {
|
||||
return;
|
||||
|
@ -1311,8 +1335,8 @@ void ReferenceProcessor::preclean_discovered_references(
|
|||
|
||||
// Phantom references
|
||||
{
|
||||
TraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC,
|
||||
false, gclog_or_tty);
|
||||
GCTraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC,
|
||||
false, gc_timer);
|
||||
for (uint i = 0; i < _max_num_q; i++) {
|
||||
if (yield->should_return()) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue