8263387: G1GarbageCollection JFR event gets gc phase, not gc type

Reviewed-by: sjohanss, ayang, iwalulya
This commit is contained in:
Thomas Schatzl 2021-03-15 18:07:44 +00:00
parent 5ab5244814
commit 4f1cda4fd7
10 changed files with 138 additions and 185 deletions

View File

@ -43,7 +43,7 @@
#include "gc/g1/g1FullCollector.hpp"
#include "gc/g1/g1GCParPhaseTimesTracker.hpp"
#include "gc/g1/g1GCPhaseTimes.hpp"
#include "gc/g1/g1GCTypes.hpp"
#include "gc/g1/g1GCPauseType.hpp"
#include "gc/g1/g1HeapSizingPolicy.hpp"
#include "gc/g1/g1HeapTransition.hpp"
#include "gc/g1/g1HeapVerifier.hpp"
@ -2848,18 +2848,15 @@ void G1CollectedHeap::expand_heap_after_young_collection(){
}
}
const char* G1CollectedHeap::young_gc_name() const {
if (collector_state()->in_concurrent_start_gc()) {
return "Pause Young (Concurrent Start)";
} else if (collector_state()->in_young_only_phase()) {
if (collector_state()->in_young_gc_before_mixed()) {
return "Pause Young (Prepare Mixed)";
} else {
return "Pause Young (Normal)";
}
} else {
return "Pause Young (Mixed)";
}
void G1CollectedHeap::set_young_gc_name(char* young_gc_name) {
G1GCPauseType pause_type =
// The strings for all Concurrent Start pauses are the same, so the parameter
// does not matter here.
collector_state()->young_gc_pause_type(false /* concurrent_operation_is_full_mark */);
snprintf(young_gc_name,
MaxYoungGCNameLength,
"Pause Young (%s)",
G1GCPauseTypeHelper::to_string(pause_type));
}
bool G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
@ -2882,6 +2879,21 @@ bool G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_
return true;
}
void G1CollectedHeap::gc_tracer_report_gc_start() {
_gc_timer_stw->register_gc_start();
_gc_tracer_stw->report_gc_start(gc_cause(), _gc_timer_stw->gc_start());
}
void G1CollectedHeap::gc_tracer_report_gc_end(bool concurrent_operation_is_full_mark,
G1EvacuationInfo& evacuation_info) {
_gc_tracer_stw->report_evacuation_info(&evacuation_info);
_gc_tracer_stw->report_tenuring_threshold(_policy->tenuring_threshold());
_gc_timer_stw->register_gc_end();
_gc_tracer_stw->report_gc_end(_gc_timer_stw->gc_end(),
_gc_timer_stw->time_partitions());
}
void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_pause_time_ms) {
GCIdMark gc_id_mark;
@ -2890,8 +2902,7 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus
policy()->note_gc_start();
_gc_timer_stw->register_gc_start();
_gc_tracer_stw->report_gc_start(gc_cause(), _gc_timer_stw->gc_start());
gc_tracer_report_gc_start();
wait_for_root_region_scanning();
@ -2926,11 +2937,12 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus
{
G1EvacuationInfo evacuation_info;
_gc_tracer_stw->report_yc_phase(collector_state()->young_gc_phase());
GCTraceCPUTime tcpu;
GCTraceTime(Info, gc) tm(young_gc_name(), NULL, gc_cause(), true);
char young_gc_name[MaxYoungGCNameLength];
set_young_gc_name(young_gc_name);
GCTraceTime(Info, gc) tm(young_gc_name, NULL, gc_cause(), true);
uint active_workers = WorkerPolicy::calc_active_workers(workers()->total_workers(),
workers()->active_workers(),
@ -2940,7 +2952,7 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus
G1MonitoringScope ms(g1mm(),
false /* full_gc */,
collector_state()->young_gc_phase() == Mixed /* all_memory_pools_affected */);
collector_state()->in_mixed_phase() /* all_memory_pools_affected */);
G1HeapTransition heap_transition(this);
@ -3008,6 +3020,10 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus
// evacuation, eventually aborting it.
concurrent_operation_is_full_mark = policy()->concurrent_operation_is_full_mark("Revise IHOP");
// Need to report the collection pause now since record_collection_pause_end()
// modifies it to the next state.
_gc_tracer_stw->report_young_gc_pause(collector_state()->young_gc_pause_type(concurrent_operation_is_full_mark));
double sample_end_time_sec = os::elapsedTime();
double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
policy()->record_collection_pause_end(pause_time_ms, concurrent_operation_is_full_mark);
@ -3042,10 +3058,7 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus
// before any GC notifications are raised.
g1mm()->update_sizes();
_gc_tracer_stw->report_evacuation_info(&evacuation_info);
_gc_tracer_stw->report_tenuring_threshold(_policy->tenuring_threshold());
_gc_timer_stw->register_gc_end();
_gc_tracer_stw->report_gc_end(_gc_timer_stw->gc_end(), _gc_timer_stw->time_partitions());
gc_tracer_report_gc_end(concurrent_operation_is_full_mark, evacuation_info);
}
// It should now be safe to tell the concurrent mark thread to start
// without its logging output interfering with the logging output

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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
@ -36,7 +36,7 @@
#include "gc/g1/g1EvacStats.hpp"
#include "gc/g1/g1EvacuationInfo.hpp"
#include "gc/g1/g1GCPhaseTimes.hpp"
#include "gc/g1/g1GCTypes.hpp"
#include "gc/g1/g1GCPauseType.hpp"
#include "gc/g1/g1HeapTransition.hpp"
#include "gc/g1/g1HeapVerifier.hpp"
#include "gc/g1/g1HRPrinter.hpp"
@ -378,7 +378,10 @@ private:
#define assert_used_and_recalculate_used_equal(g1h) do {} while(0)
#endif
const char* young_gc_name() const;
static const uint MaxYoungGCNameLength = 128;
// Sets given young_gc_name to the canonical young gc pause string. Young_gc_name
// must be at least of length MaxYoungGCNameLength.
void set_young_gc_name(char* young_gc_name);
// The young region list.
G1EdenRegions _eden;
@ -388,6 +391,9 @@ private:
G1NewTracer* _gc_tracer_stw;
void gc_tracer_report_gc_start();
void gc_tracer_report_gc_end(bool concurrent_operation_is_full_mark, G1EvacuationInfo& evacuation_info);
// The current policy object for the collector.
G1Policy* _policy;
G1HeapSizingPolicy* _heap_sizing_policy;

View File

@ -24,37 +24,24 @@
#include "precompiled.hpp"
#include "gc/g1/g1CollectorState.hpp"
#include "gc/g1/g1GCTypes.hpp"
#include "gc/g1/g1GCPauseType.hpp"
G1GCPauseType G1CollectorState::young_gc_pause_type(bool concurrent_operation_is_full_mark) const {
assert(!in_full_gc(), "must be");
if (in_concurrent_start_gc()) {
assert(!in_young_gc_before_mixed(), "must be");
return concurrent_operation_is_full_mark ? ConcurrentStartMarkGC : ConcurrentStartUndoGC;
return concurrent_operation_is_full_mark ? G1GCPauseType::ConcurrentStartMarkGC :
G1GCPauseType::ConcurrentStartUndoGC;
} else if (in_young_gc_before_mixed()) {
assert(!in_concurrent_start_gc(), "must be");
return LastYoungGC;
return G1GCPauseType::LastYoungGC;
} else if (in_mixed_phase()) {
assert(!in_concurrent_start_gc(), "must be");
assert(!in_young_gc_before_mixed(), "must be");
return MixedGC;
return G1GCPauseType::MixedGC;
} else {
assert(!in_concurrent_start_gc(), "must be");
assert(!in_young_gc_before_mixed(), "must be");
return YoungGC;
}
}
G1GCYoungPhase G1CollectorState::young_gc_phase() const {
assert(!in_full_gc(), "must be");
if (in_concurrent_start_gc()) {
return ConcurrentStart;
} else if (mark_or_rebuild_in_progress()) {
return DuringMarkOrRebuild;
} else if (in_young_only_phase()) {
return Normal;
} else {
return Mixed;
return G1GCPauseType::YoungGC;
}
}

View File

@ -25,7 +25,7 @@
#ifndef SHARE_GC_G1_G1COLLECTORSTATE_HPP
#define SHARE_GC_G1_G1COLLECTORSTATE_HPP
#include "gc/g1/g1GCTypes.hpp"
#include "gc/g1/g1GCPauseType.hpp"
#include "utilities/globalDefinitions.hpp"
// State of the G1 collection.
@ -112,8 +112,6 @@ public:
// Calculate GC Pause Type from internal state.
G1GCPauseType young_gc_pause_type(bool concurrent_operation_is_full_mark) const;
G1GCYoungPhase young_gc_phase() const;
};
#endif // SHARE_GC_G1_G1COLLECTORSTATE_HPP

View File

@ -22,21 +22,13 @@
*
*/
#ifndef SHARE_GC_G1_G1GCTYPES_HPP
#define SHARE_GC_G1_G1GCTYPES_HPP
#ifndef SHARE_GC_G1_G1GCPAUSETYPES_HPP
#define SHARE_GC_G1_G1GCPAUSETYPES_HPP
#include "utilities/debug.hpp"
#include "utilities/enumIterator.hpp"
// Enumarate the phases in which the collection cycle can be.
enum G1GCYoungPhase {
Normal,
ConcurrentStart,
DuringMarkOrRebuild,
Mixed,
G1GCYoungPhaseEndSentinel
};
enum G1GCPauseType {
enum class G1GCPauseType : uint {
YoungGC,
LastYoungGC,
ConcurrentStartMarkGC,
@ -44,51 +36,54 @@ enum G1GCPauseType {
Cleanup,
Remark,
MixedGC,
FullGC,
G1GCPauseTypeEndSentinel
FullGC
};
class G1GCTypeHelper {
public:
ENUMERATOR_RANGE(G1GCPauseType, G1GCPauseType::YoungGC, G1GCPauseType::FullGC)
class G1GCPauseTypeHelper {
public:
static void assert_is_young_pause(G1GCPauseType type) {
assert(type != FullGC, "must be");
assert(type != Remark, "must be");
assert(type != Cleanup, "must be");
assert(type != G1GCPauseType::FullGC, "must be");
assert(type != G1GCPauseType::Remark, "must be");
assert(type != G1GCPauseType::Cleanup, "must be");
}
static bool is_young_only_pause(G1GCPauseType type) {
assert_is_young_pause(type);
return type == ConcurrentStartUndoGC ||
type == ConcurrentStartMarkGC ||
type == LastYoungGC ||
type == YoungGC;
return type == G1GCPauseType::ConcurrentStartUndoGC ||
type == G1GCPauseType::ConcurrentStartMarkGC ||
type == G1GCPauseType::LastYoungGC ||
type == G1GCPauseType::YoungGC;
}
static bool is_mixed_pause(G1GCPauseType type) {
assert_is_young_pause(type);
return type == MixedGC;
return type == G1GCPauseType::MixedGC;
}
static bool is_last_young_pause(G1GCPauseType type) {
assert_is_young_pause(type);
return type == LastYoungGC;
return type == G1GCPauseType::LastYoungGC;
}
static bool is_concurrent_start_pause(G1GCPauseType type) {
assert_is_young_pause(type);
return type == ConcurrentStartMarkGC || type == ConcurrentStartUndoGC;
return type == G1GCPauseType::ConcurrentStartMarkGC || type == G1GCPauseType::ConcurrentStartUndoGC;
}
static const char* to_string(G1GCYoungPhase type) {
switch(type) {
case Normal: return "Normal";
case ConcurrentStart: return "Concurrent Start";
case DuringMarkOrRebuild: return "During Mark";
case Mixed: return "Mixed";
default: ShouldNotReachHere(); return NULL;
}
static const char* to_string(G1GCPauseType type) {
static const char* pause_strings[] = { "Normal",
"Prepare Mixed",
"Concurrent Start", // Do not distinguish between the different
"Concurrent Start", // Concurrent Start pauses.
"Cleanup",
"Remark",
"Mixed",
"Full" };
return pause_strings[static_cast<uint>(type)];
}
};
#endif // SHARE_GC_G1_G1GCTYPES_HPP
#endif // SHARE_GC_G1_G1GCPAUSETYPES_HPP

View File

@ -457,7 +457,7 @@ void G1Policy::record_full_collection_end() {
_old_gen_alloc_tracker.reset_after_gc(_g1h->humongous_regions_count() * HeapRegion::GrainBytes);
record_pause(FullGC, _full_collection_start_sec, end_sec);
record_pause(G1GCPauseType::FullGC, _full_collection_start_sec, end_sec);
}
static void log_refinement_stats(const char* kind, const G1ConcurrentRefineStats& stats) {
@ -551,7 +551,7 @@ void G1Policy::record_concurrent_mark_remark_end() {
double elapsed_time_ms = (end_time_sec - _mark_remark_start_sec)*1000.0;
_analytics->report_concurrent_mark_remark_times_ms(elapsed_time_ms);
record_pause(Remark, _mark_remark_start_sec, end_time_sec);
record_pause(G1GCPauseType::Remark, _mark_remark_start_sec, end_time_sec);
}
void G1Policy::record_concurrent_mark_cleanup_start() {
@ -635,7 +635,7 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, bool concurrent
bool update_stats = should_update_gc_stats();
if (G1GCTypeHelper::is_concurrent_start_pause(this_pause)) {
if (G1GCPauseTypeHelper::is_concurrent_start_pause(this_pause)) {
record_concurrent_mark_init_end();
} else {
maybe_start_marking();
@ -665,15 +665,15 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, bool concurrent
record_pause(this_pause, start_time_sec, end_time_sec);
if (G1GCTypeHelper::is_last_young_pause(this_pause)) {
assert(!G1GCTypeHelper::is_concurrent_start_pause(this_pause),
if (G1GCPauseTypeHelper::is_last_young_pause(this_pause)) {
assert(!G1GCPauseTypeHelper::is_concurrent_start_pause(this_pause),
"The young GC before mixed is not allowed to be concurrent start GC");
// This has been the young GC before we start doing mixed GCs. We already
// decided to start mixed GCs much earlier, so there is nothing to do except
// advancing the state.
collector_state()->set_in_young_only_phase(false);
collector_state()->set_in_young_gc_before_mixed(false);
} else if (G1GCTypeHelper::is_mixed_pause(this_pause)) {
} else if (G1GCPauseTypeHelper::is_mixed_pause(this_pause)) {
// This is a mixed GC. Here we decide whether to continue doing more
// mixed GCs or not.
if (!next_gc_should_be_mixed("continue mixed GCs",
@ -684,7 +684,7 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, bool concurrent
maybe_start_marking();
}
} else {
assert(G1GCTypeHelper::is_young_only_pause(this_pause), "must be");
assert(G1GCPauseTypeHelper::is_young_only_pause(this_pause), "must be");
}
_eden_surv_rate_group->start_adding_regions();
@ -709,7 +709,7 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, bool concurrent
average_time_ms(G1GCPhaseTimes::MergeLB) +
average_time_ms(G1GCPhaseTimes::OptMergeRS);
_analytics->report_cost_per_card_merge_ms(avg_time_merge_cards / total_cards_merged,
G1GCTypeHelper::is_young_only_pause(this_pause));
G1GCPauseTypeHelper::is_young_only_pause(this_pause));
}
// Update prediction for card scan
@ -721,7 +721,7 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, bool concurrent
average_time_ms(G1GCPhaseTimes::OptScanHR);
_analytics->report_cost_per_card_scan_ms(avg_time_dirty_card_scan / total_cards_scanned,
G1GCTypeHelper::is_young_only_pause(this_pause));
G1GCPauseTypeHelper::is_young_only_pause(this_pause));
}
// Update prediction for the ratio between cards from the remembered
@ -736,7 +736,7 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, bool concurrent
merge_to_scan_ratio = (double) from_rs_length_cards / total_cards_scanned;
}
_analytics->report_card_merge_to_scan_ratio(merge_to_scan_ratio,
G1GCTypeHelper::is_young_only_pause(this_pause));
G1GCPauseTypeHelper::is_young_only_pause(this_pause));
const size_t recorded_rs_length = _collection_set->recorded_rs_length();
const size_t rs_length_diff = _rs_length > recorded_rs_length ? _rs_length - recorded_rs_length : 0;
@ -766,15 +766,15 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, bool concurrent
// these are is wildly different to during young only gc and mess up young gen sizing right
// after the mixed gc phase.
// During mixed gc we do not use them for young gen sizing.
if (G1GCTypeHelper::is_young_only_pause(this_pause)) {
if (G1GCPauseTypeHelper::is_young_only_pause(this_pause)) {
_analytics->report_pending_cards((double) _pending_cards_at_gc_start);
_analytics->report_rs_length((double) _rs_length);
}
}
assert(!(G1GCTypeHelper::is_concurrent_start_pause(this_pause) && collector_state()->mark_or_rebuild_in_progress()),
assert(!(G1GCPauseTypeHelper::is_concurrent_start_pause(this_pause) && collector_state()->mark_or_rebuild_in_progress()),
"If the last pause has been concurrent start, we should not have been in the marking window");
if (G1GCTypeHelper::is_concurrent_start_pause(this_pause)) {
if (G1GCPauseTypeHelper::is_concurrent_start_pause(this_pause)) {
collector_state()->set_mark_or_rebuild_in_progress(concurrent_operation_is_full_mark);
}
@ -794,7 +794,7 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, bool concurrent
_old_gen_alloc_tracker.reset_after_gc(_g1h->humongous_regions_count() * HeapRegion::GrainBytes);
update_ihop_prediction(app_time_ms / 1000.0,
last_unrestrained_young_length * HeapRegion::GrainBytes,
G1GCTypeHelper::is_young_only_pause(this_pause));
G1GCPauseTypeHelper::is_young_only_pause(this_pause));
_ihop_control->send_trace_event(_g1h->gc_tracer_stw());
} else {
@ -1120,7 +1120,7 @@ void G1Policy::record_concurrent_mark_cleanup_end() {
double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0;
_analytics->report_concurrent_mark_cleanup_times_ms(elapsed_time_ms);
record_pause(Cleanup, _mark_cleanup_start_sec, end_sec);
record_pause(G1GCPauseType::Cleanup, _mark_cleanup_start_sec, end_sec);
}
double G1Policy::reclaimable_bytes_percent(size_t reclaimable_bytes) const {
@ -1165,7 +1165,7 @@ void G1Policy::update_gc_pause_time_ratios(G1GCPauseType gc_type, double start_t
_analytics->compute_pause_time_ratios(end_time_sec, pause_time_ms);
_analytics->update_recent_gc_times(end_time_sec, pause_time_ms);
if (gc_type == Cleanup || gc_type == Remark) {
if (gc_type == G1GCPauseType::Cleanup || gc_type == G1GCPauseType::Remark) {
_analytics->append_prev_collection_pause_end_ms(pause_time_ms);
} else {
_analytics->set_prev_collection_pause_end_ms(end_time_sec * 1000.0);
@ -1176,7 +1176,7 @@ void G1Policy::record_pause(G1GCPauseType gc_type,
double start,
double end) {
// Manage the MMU tracker. For some reason it ignores Full GCs.
if (gc_type != FullGC) {
if (gc_type != G1GCPauseType::FullGC) {
_mmu_tracker->add_pause(start, end);
}
@ -1192,16 +1192,16 @@ void G1Policy::update_time_to_mixed_tracking(G1GCPauseType gc_type,
double end) {
// Manage the mutator time tracking from concurrent start to first mixed gc.
switch (gc_type) {
case FullGC:
case G1GCPauseType::FullGC:
abort_time_to_mixed_tracking();
break;
case Cleanup:
case Remark:
case YoungGC:
case LastYoungGC:
case G1GCPauseType::Cleanup:
case G1GCPauseType::Remark:
case G1GCPauseType::YoungGC:
case G1GCPauseType::LastYoungGC:
_concurrent_start_to_mixed.add_pause(end - start);
break;
case ConcurrentStartMarkGC:
case G1GCPauseType::ConcurrentStartMarkGC:
// Do not track time-to-mixed time for periodic collections as they are likely
// to be not representative to regular operation as the mutators are idle at
// that time. Also only track full concurrent mark cycles.
@ -1209,12 +1209,12 @@ void G1Policy::update_time_to_mixed_tracking(G1GCPauseType gc_type,
_concurrent_start_to_mixed.record_concurrent_start_end(end);
}
break;
case ConcurrentStartUndoGC:
case G1GCPauseType::ConcurrentStartUndoGC:
assert(_g1h->gc_cause() == GCCause::_g1_humongous_allocation,
"GC cause must be humongous allocation but is %d",
_g1h->gc_cause());
break;
case MixedGC:
case G1GCPauseType::MixedGC:
_concurrent_start_to_mixed.record_mixed_gc_start(start);
break;
default:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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
@ -26,7 +26,7 @@
#include "gc/g1/g1EvacuationInfo.hpp"
#include "gc/g1/g1HeapRegionTraceType.hpp"
#include "gc/g1/g1Trace.hpp"
#include "gc/g1/g1GCTypes.hpp"
#include "gc/g1/g1GCPauseType.hpp"
#include "gc/shared/gcHeapSummary.hpp"
#include "jfr/jfrEvents.hpp"
#if INCLUDE_JFR
@ -37,23 +37,24 @@
class G1HeapRegionTypeConstant : public JfrSerializer {
public:
void serialize(JfrCheckpointWriter& writer) {
static const u4 nof_entries = G1HeapRegionTraceType::G1HeapRegionTypeEndSentinel;
writer.write_count(nof_entries);
for (u4 i = 0; i < nof_entries; ++i) {
writer.write_key(i);
writer.write(G1HeapRegionTraceType::to_string((G1HeapRegionTraceType::Type)i));
static const u4 nof_entries = G1HeapRegionTraceType::G1HeapRegionTypeEndSentinel;
writer.write_count(nof_entries);
for (u4 i = 0; i < nof_entries; ++i) {
writer.write_key(i);
writer.write(G1HeapRegionTraceType::to_string((G1HeapRegionTraceType::Type)i));
}
}
}
};
class G1YCTypeConstant : public JfrSerializer {
public:
void serialize(JfrCheckpointWriter& writer) {
static const u4 nof_entries = G1GCYoungPhaseEndSentinel;
constexpr EnumRange<G1GCPauseType> types{};
static const u4 nof_entries = static_cast<u4>(types.size());
writer.write_count(nof_entries);
for (u4 i = 0; i < nof_entries; ++i) {
writer.write_key(i);
writer.write(G1GCTypeHelper::to_string((G1GCYoungPhase)i));
for (auto index : types) {
writer.write_key(static_cast<uint>(index));
writer.write(G1GCPauseTypeHelper::to_string(index));
}
}
};
@ -72,8 +73,9 @@ void G1NewTracer::initialize() {
JFR_ONLY(register_jfr_type_constants());
}
void G1NewTracer::report_yc_phase(G1GCYoungPhase phase) {
_g1_young_gc_info.set_phase(phase);
void G1NewTracer::report_young_gc_pause(G1GCPauseType pause) {
G1GCPauseTypeHelper::assert_is_young_pause(pause);
_pause = pause;
}
void G1NewTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
@ -126,10 +128,13 @@ void G1NewTracer::report_adaptive_ihop_statistics(size_t threshold,
}
void G1NewTracer::send_g1_young_gc_event() {
// Check that the pause type has been updated to something valid for this event.
G1GCPauseTypeHelper::assert_is_young_pause(_pause);
EventG1GarbageCollection e(UNTIMED);
if (e.should_commit()) {
e.set_gcId(GCId::current());
e.set_type(_g1_young_gc_info.phase());
e.set_type(static_cast<uint>(_pause));
e.set_starttime(_shared_gc_info.start_timestamp());
e.set_endtime(_shared_gc_info.end_timestamp());
e.commit();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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,31 +25,25 @@
#ifndef SHARE_GC_G1_G1TRACE_HPP
#define SHARE_GC_G1_G1TRACE_HPP
#include "gc/g1/g1GCTypes.hpp"
#include "gc/g1/g1GCPauseType.hpp"
#include "gc/shared/gcTrace.hpp"
class G1EvacuationInfo;
class G1HeapSummary;
class G1EvacSummary;
class G1YoungGCInfo {
G1GCYoungPhase _phase;
public:
G1YoungGCInfo() : _phase(G1GCYoungPhaseEndSentinel) {}
void set_phase(G1GCYoungPhase phase) {
_phase = phase;
}
G1GCYoungPhase phase() const { return _phase; }
};
class G1NewTracer : public YoungGCTracer {
G1YoungGCInfo _g1_young_gc_info;
G1GCPauseType _pause;
public:
G1NewTracer() : YoungGCTracer(G1New) {}
G1NewTracer() :
YoungGCTracer(G1New),
_pause(G1GCPauseType::FullGC) // Initialize to something invalid. For this event, which
// is about young collections, FullGC is not a valid value.
{ }
void initialize();
void report_yc_phase(G1GCYoungPhase phase);
void report_young_gc_pause(G1GCPauseType pause);
void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
void report_evacuation_info(G1EvacuationInfo* info);
void report_evacuation_failed(EvacuationFailedInfo& ef_info);

View File

@ -293,9 +293,9 @@
<Field type="uint" name="gcId" label="GC Identifier" relation="GcId" />
</Event>
<Event name="G1GarbageCollection" category="Java Virtual Machine, GC, Collector" label="G1 Garbage Collection" description="Extra information specific to G1 Garbage Collections">
<Event name="G1GarbageCollection" category="Java Virtual Machine, GC, Collector" label="G1 Young Garbage Collection" description="Extra information specific to G1 Young Garbage Collections">
<Field type="uint" name="gcId" label="GC Identifier" relation="GcId" />
<Field type="G1YCType" name="type" label="Type" />
<Field type="G1YCType" name="type" label="Type"/>
</Event>
<Event name="G1MMU" category="Java Virtual Machine, GC, Detailed" label="G1 MMU Information" startTime="false">

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2014, 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.gc.shared;
//These definitions should be kept in sync with the definitions in the HotSpot
//code.
public enum G1YCType {
Normal ("Normal"),
ConcurrentStart ("Concurrent Start"),
DuringMark ("During Mark"),
Mixed ("Mixed"),
G1YCTypeEndSentinel ("Unknown");
private final String value;
G1YCType(String val) {
this.value = val;
}
public String value() {
return value;
}
}