mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +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,10 @@
|
|||
#include "precompiled.hpp"
|
||||
#include "gc_implementation/shared/collectorCounters.hpp"
|
||||
#include "gc_implementation/shared/gcPolicyCounters.hpp"
|
||||
#include "gc_implementation/shared/gcHeapSummary.hpp"
|
||||
#include "gc_implementation/shared/gcTimer.hpp"
|
||||
#include "gc_implementation/shared/gcTraceTime.hpp"
|
||||
#include "gc_implementation/shared/gcTrace.hpp"
|
||||
#include "gc_implementation/shared/spaceDecorator.hpp"
|
||||
#include "memory/defNewGeneration.inline.hpp"
|
||||
#include "memory/gcLocker.inline.hpp"
|
||||
|
@ -223,6 +227,8 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
|
|||
_next_gen = NULL;
|
||||
_tenuring_threshold = MaxTenuringThreshold;
|
||||
_pretenure_size_threshold_words = PretenureSizeThreshold >> LogHeapWordSize;
|
||||
|
||||
_gc_timer = new (ResourceObj::C_HEAP, mtGC) STWGCTimer();
|
||||
}
|
||||
|
||||
void DefNewGeneration::compute_space_boundaries(uintx minimum_eden_size,
|
||||
|
@ -558,12 +564,18 @@ void DefNewGeneration::collect(bool full,
|
|||
size_t size,
|
||||
bool is_tlab) {
|
||||
assert(full || size > 0, "otherwise we don't want to collect");
|
||||
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
|
||||
_gc_timer->register_gc_start(os::elapsed_counter());
|
||||
DefNewTracer gc_tracer;
|
||||
gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
|
||||
|
||||
_next_gen = gch->next_gen(this);
|
||||
assert(_next_gen != NULL,
|
||||
"This must be the youngest gen, and not the only gen");
|
||||
|
||||
// If the next generation is too full to accomodate promotion
|
||||
// If the next generation is too full to accommodate promotion
|
||||
// from this generation, pass on collection; let the next generation
|
||||
// do it.
|
||||
if (!collection_attempt_is_safe()) {
|
||||
|
@ -577,10 +589,12 @@ void DefNewGeneration::collect(bool full,
|
|||
|
||||
init_assuming_no_promotion_failure();
|
||||
|
||||
TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty);
|
||||
GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL);
|
||||
// Capture heap used before collection (for printing).
|
||||
size_t gch_prev_used = gch->used();
|
||||
|
||||
gch->trace_heap_before_gc(&gc_tracer);
|
||||
|
||||
SpecializationStats::clear();
|
||||
|
||||
// These can be shared for all code paths
|
||||
|
@ -631,9 +645,12 @@ void DefNewGeneration::collect(bool full,
|
|||
FastKeepAliveClosure keep_alive(this, &scan_weak_ref);
|
||||
ReferenceProcessor* rp = ref_processor();
|
||||
rp->setup_policy(clear_all_soft_refs);
|
||||
const ReferenceProcessorStats& stats =
|
||||
rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers,
|
||||
NULL);
|
||||
if (!promotion_failed()) {
|
||||
NULL, _gc_timer);
|
||||
gc_tracer.report_gc_reference_stats(stats);
|
||||
|
||||
if (!_promotion_failed) {
|
||||
// Swap the survivor spaces.
|
||||
eden()->clear(SpaceDecorator::Mangle);
|
||||
from()->clear(SpaceDecorator::Mangle);
|
||||
|
@ -680,6 +697,7 @@ void DefNewGeneration::collect(bool full,
|
|||
|
||||
// Inform the next generation that a promotion failure occurred.
|
||||
_next_gen->promotion_failure_occurred();
|
||||
gc_tracer.report_promotion_failed(_promotion_failed_info);
|
||||
|
||||
// Reset the PromotionFailureALot counters.
|
||||
NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();)
|
||||
|
@ -689,11 +707,18 @@ void DefNewGeneration::collect(bool full,
|
|||
to()->set_concurrent_iteration_safe_limit(to()->top());
|
||||
SpecializationStats::print();
|
||||
|
||||
// We need to use a monotonically non-deccreasing time in ms
|
||||
// We need to use a monotonically non-decreasing time in ms
|
||||
// or we will see time-warp warnings and os::javaTimeMillis()
|
||||
// does not guarantee monotonicity.
|
||||
jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
|
||||
update_time_of_last_gc(now);
|
||||
|
||||
gch->trace_heap_after_gc(&gc_tracer);
|
||||
gc_tracer.report_tenuring_threshold(tenuring_threshold());
|
||||
|
||||
_gc_timer->register_gc_end(os::elapsed_counter());
|
||||
|
||||
gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
|
||||
}
|
||||
|
||||
class RemoveForwardPointerClosure: public ObjectClosure {
|
||||
|
@ -705,6 +730,7 @@ public:
|
|||
|
||||
void DefNewGeneration::init_assuming_no_promotion_failure() {
|
||||
_promotion_failed = false;
|
||||
_promotion_failed_info.reset();
|
||||
from()->set_next_compaction_space(NULL);
|
||||
}
|
||||
|
||||
|
@ -726,7 +752,7 @@ void DefNewGeneration::remove_forwarding_pointers() {
|
|||
}
|
||||
|
||||
void DefNewGeneration::preserve_mark(oop obj, markOop m) {
|
||||
assert(promotion_failed() && m->must_be_preserved_for_promotion_failure(obj),
|
||||
assert(_promotion_failed && m->must_be_preserved_for_promotion_failure(obj),
|
||||
"Oversaving!");
|
||||
_objs_with_preserved_marks.push(obj);
|
||||
_preserved_marks_of_objs.push(m);
|
||||
|
@ -744,6 +770,7 @@ void DefNewGeneration::handle_promotion_failure(oop old) {
|
|||
old->size());
|
||||
}
|
||||
_promotion_failed = true;
|
||||
_promotion_failed_info.register_copy_failure(old->size());
|
||||
preserve_mark_if_necessary(old, old->mark());
|
||||
// forward to self
|
||||
old->forward_to(old);
|
||||
|
@ -962,6 +989,10 @@ void DefNewGeneration::record_spaces_top() {
|
|||
from()->set_top_for_allocations();
|
||||
}
|
||||
|
||||
void DefNewGeneration::ref_processor_init() {
|
||||
Generation::ref_processor_init();
|
||||
}
|
||||
|
||||
|
||||
void DefNewGeneration::update_counters() {
|
||||
if (UsePerfData) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue