From cf2d66d598d90f1343d1ad7a4f30607c3374a0f8 Mon Sep 17 00:00:00 2001 From: suchismith1993 Date: Mon, 16 Jun 2025 10:35:55 -0400 Subject: [PATCH 1/6] update_capacity exists --- .../gc/epsilon/epsilonMonitoringSupport.cpp | 12 ++++++------ src/hotspot/share/gc/g1/g1MonitoringSupport.cpp | 16 ++++++++-------- src/hotspot/share/gc/parallel/psOldGen.cpp | 6 +++--- src/hotspot/share/gc/parallel/psYoungGen.cpp | 8 ++++---- src/hotspot/share/gc/parallel/spaceCounters.hpp | 4 ++-- src/hotspot/share/gc/serial/cSpaceCounters.cpp | 2 +- src/hotspot/share/gc/serial/cSpaceCounters.hpp | 4 ++-- src/hotspot/share/gc/serial/defNewGeneration.cpp | 8 ++++---- .../share/gc/serial/tenuredGeneration.cpp | 4 ++-- .../share/gc/shared/generationCounters.cpp | 2 +- .../share/gc/shared/generationCounters.hpp | 4 ++-- src/hotspot/share/gc/shared/hSpaceCounters.cpp | 2 +- src/hotspot/share/gc/shared/hSpaceCounters.hpp | 4 ++-- .../shenandoah/shenandoahMonitoringSupport.cpp | 12 ++++++------ src/hotspot/share/gc/z/zServiceability.cpp | 2 +- 15 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp b/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp index a2ae6f8a14a9d..f3c599af9d988 100644 --- a/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2025, Red Hat, Inc. 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 @@ -75,7 +75,7 @@ class EpsilonSpaceCounters: public CHeapObj { FREE_C_HEAP_ARRAY(char, _name_space); } - inline void update_all(size_t capacity, size_t used) { + inline void update_memory_state(size_t capacity, size_t used) { _capacity->set_value(capacity); _used->set_value(used); } @@ -90,8 +90,8 @@ class EpsilonGenerationCounters : public GenerationCounters { _heap(heap) {}; - void update_all() { - GenerationCounters::update_all(_heap->capacity()); + void update_memory_state() { + GenerationCounters::update_memory_state(_heap->capacity()); } }; @@ -107,8 +107,8 @@ void EpsilonMonitoringSupport::update_counters() { EpsilonHeap* heap = EpsilonHeap::heap(); size_t used = heap->used(); size_t capacity = heap->capacity(); - _heap_counters->update_all(); - _space_counters->update_all(capacity, used); + _heap_counters->update_memory_state(); + _space_counters->update_memory_state(capacity, used); MetaspaceCounters::update_performance_counters(); } } diff --git a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp index 6d1ffdb7c005a..73694ae9d4b1a 100644 --- a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp +++ b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp @@ -56,13 +56,13 @@ class G1YoungGenerationCounters : public G1GenerationCounters { max_size, 0 /* curr_capacity */) { if (UsePerfData) { - update_all(); + update_memory_state(); } } - void update_all() { + void update_memory_state() { size_t committed = _monitoring_support->young_gen_committed(); - GenerationCounters::update_all(committed); + GenerationCounters::update_memory_state(committed); } }; @@ -77,13 +77,13 @@ class G1OldGenerationCounters : public G1GenerationCounters { max_size, 0 /* curr_capacity */) { if (UsePerfData) { - update_all(); + update_memory_state(); } } - void update_all() { + void update_memory_state() { size_t committed = _monitoring_support->old_gen_committed(); - GenerationCounters::update_all(committed); + GenerationCounters::update_memory_state(committed); } }; @@ -305,8 +305,8 @@ void G1MonitoringSupport::update_sizes() { _old_space_counters->update_capacity(_old_gen_committed); _old_space_counters->update_used(_old_gen_used); - _young_gen_counters->update_all(); - _old_gen_counters->update_all(); + _young_gen_counters->update_memory_state(); + _old_gen_counters->update_memory_state(); MetaspaceCounters::update_performance_counters(); } diff --git a/src/hotspot/share/gc/parallel/psOldGen.cpp b/src/hotspot/share/gc/parallel/psOldGen.cpp index 3bf125bc295da..2781acaa95d67 100644 --- a/src/hotspot/share/gc/parallel/psOldGen.cpp +++ b/src/hotspot/share/gc/parallel/psOldGen.cpp @@ -237,7 +237,7 @@ bool PSOldGen::expand_by(size_t bytes) { post_resize(); if (UsePerfData) { _space_counters->update_capacity(); - _gen_counters->update_all(_virtual_space->committed_size()); + _gen_counters->update_memory_state(_virtual_space->committed_size()); } } @@ -368,8 +368,8 @@ void PSOldGen::print_on(outputStream* st) const { void PSOldGen::update_counters() { if (UsePerfData) { - _space_counters->update_all(); - _gen_counters->update_all(_virtual_space->committed_size()); + _space_counters->update_memory_state(); + _gen_counters->update_memory_state(_virtual_space->committed_size()); } } diff --git a/src/hotspot/share/gc/parallel/psYoungGen.cpp b/src/hotspot/share/gc/parallel/psYoungGen.cpp index cf21e45da9e72..b59721d3e402c 100644 --- a/src/hotspot/share/gc/parallel/psYoungGen.cpp +++ b/src/hotspot/share/gc/parallel/psYoungGen.cpp @@ -807,10 +807,10 @@ void PSYoungGen::post_resize() { void PSYoungGen::update_counters() { if (UsePerfData) { - _eden_counters->update_all(); - _from_counters->update_all(); - _to_counters->update_all(); - _gen_counters->update_all(_virtual_space->committed_size()); + _eden_counters->update_memory_state(); + _from_counters->update_memory_state(); + _to_counters->update_memory_state(); + _gen_counters->update_memory_state(_virtual_space->committed_size()); } } diff --git a/src/hotspot/share/gc/parallel/spaceCounters.hpp b/src/hotspot/share/gc/parallel/spaceCounters.hpp index 3d0c1ff7b5015..ded1f02627d9d 100644 --- a/src/hotspot/share/gc/parallel/spaceCounters.hpp +++ b/src/hotspot/share/gc/parallel/spaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -63,7 +63,7 @@ class SpaceCounters: public CHeapObj { void update_used(); - inline void update_all() { + inline void update_memory_state() { update_used(); update_capacity(); } diff --git a/src/hotspot/share/gc/serial/cSpaceCounters.cpp b/src/hotspot/share/gc/serial/cSpaceCounters.cpp index 9f8b91e205cd0..e75da7a6c0aa5 100644 --- a/src/hotspot/share/gc/serial/cSpaceCounters.cpp +++ b/src/hotspot/share/gc/serial/cSpaceCounters.cpp @@ -80,7 +80,7 @@ void CSpaceCounters::update_used() { _used->set_value(new_used); } -void CSpaceCounters::update_all() { +void CSpaceCounters::update_memory_state() { update_used(); update_capacity(); } diff --git a/src/hotspot/share/gc/serial/cSpaceCounters.hpp b/src/hotspot/share/gc/serial/cSpaceCounters.hpp index 334f649382bfe..e35c7032043bc 100644 --- a/src/hotspot/share/gc/serial/cSpaceCounters.hpp +++ b/src/hotspot/share/gc/serial/cSpaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -59,7 +59,7 @@ class CSpaceCounters: public CHeapObj { void update_capacity(); void update_used(); - void update_all(); + void update_memory_state(); const char* name_space() const { return _name_space; } }; diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index cebfa743eac70..ad2aa56355f22 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -811,10 +811,10 @@ void DefNewGeneration::gc_epilogue(bool full) { void DefNewGeneration::update_counters() { if (UsePerfData) { - _eden_counters->update_all(); - _from_counters->update_all(); - _to_counters->update_all(); - _gen_counters->update_all(_virtual_space.committed_size()); + _eden_counters->update_memory_state(); + _from_counters->update_memory_state(); + _to_counters->update_memory_state(); + _gen_counters->update_memory_state(_virtual_space.committed_size()); } } diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index 975b0b5f98a99..35beba1382672 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -367,8 +367,8 @@ void TenuredGeneration::update_promote_stats() { void TenuredGeneration::update_counters() { if (UsePerfData) { - _space_counters->update_all(); - _gen_counters->update_all(_virtual_space.committed_size()); + _space_counters->update_memory_state(); + _gen_counters->update_memory_state(_virtual_space.committed_size()); } } diff --git a/src/hotspot/share/gc/shared/generationCounters.cpp b/src/hotspot/share/gc/shared/generationCounters.cpp index 4af7b412aea55..b841d9f584436 100644 --- a/src/hotspot/share/gc/shared/generationCounters.cpp +++ b/src/hotspot/share/gc/shared/generationCounters.cpp @@ -67,7 +67,7 @@ GenerationCounters::~GenerationCounters() { FREE_C_HEAP_ARRAY(char, _name_space); } -void GenerationCounters::update_all(size_t curr_capacity) { +void GenerationCounters::update_memory_state(size_t curr_capacity) { _current_size->set_value(curr_capacity); } diff --git a/src/hotspot/share/gc/shared/generationCounters.hpp b/src/hotspot/share/gc/shared/generationCounters.hpp index 50672ab5d74f8..ae4b0ba87315d 100644 --- a/src/hotspot/share/gc/shared/generationCounters.hpp +++ b/src/hotspot/share/gc/shared/generationCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -52,7 +52,7 @@ class GenerationCounters: public CHeapObj { ~GenerationCounters(); - void update_all(size_t curr_capacity); + void update_memory_state(size_t curr_capacity); const char* name_space() const { return _name_space; } }; diff --git a/src/hotspot/share/gc/shared/hSpaceCounters.cpp b/src/hotspot/share/gc/shared/hSpaceCounters.cpp index 818d7422fba45..26eaafb283dd2 100644 --- a/src/hotspot/share/gc/shared/hSpaceCounters.cpp +++ b/src/hotspot/share/gc/shared/hSpaceCounters.cpp @@ -77,7 +77,7 @@ void HSpaceCounters::update_used(size_t v) { _used->set_value(v); } -void HSpaceCounters::update_all(size_t capacity, size_t used) { +void HSpaceCounters::update_memory_state(size_t capacity, size_t used) { update_capacity(capacity); update_used(used); } diff --git a/src/hotspot/share/gc/shared/hSpaceCounters.hpp b/src/hotspot/share/gc/shared/hSpaceCounters.hpp index 01310e456f62c..cc14ac7c8227e 100644 --- a/src/hotspot/share/gc/shared/hSpaceCounters.hpp +++ b/src/hotspot/share/gc/shared/hSpaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -54,7 +54,7 @@ class HSpaceCounters: public CHeapObj { void update_capacity(size_t v); void update_used(size_t v); - void update_all(size_t capacity, size_t used); + void update_memory_state(size_t capacity, size_t used); DEBUG_ONLY( // for security reasons, we do not allow arbitrary reads from diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp index 6b72cbdd62bba..6dca1fbc8a685 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved. + * Copyright (c) 2015, 2025, Red Hat, Inc. 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 @@ class ShenandoahYoungGenerationCounters : public GenerationCounters { ShenandoahYoungGenerationCounters() : GenerationCounters("Young", 0, 0, 0, (size_t)0, (size_t)0) {}; - void update_all() { + void update_memory_state() { // no update } }; @@ -50,8 +50,8 @@ class ShenandoahGenerationCounters : public GenerationCounters { _heap(heap) {}; - void update_all() { - GenerationCounters::update_all(_heap->capacity()); + void update_memory_state() { + GenerationCounters::update_memory_state(_heap->capacity()); } }; @@ -98,8 +98,8 @@ void ShenandoahMonitoringSupport::update_counters() { ShenandoahHeap* heap = ShenandoahHeap::heap(); size_t used = heap->used(); size_t capacity = heap->max_capacity(); - _heap_counters->update_all(); - _space_counters->update_all(capacity, used); + _heap_counters->update_memory_state(); + _space_counters->update_memory_state(capacity, used); _heap_region_counters->update(); MetaspaceCounters::update_performance_counters(); diff --git a/src/hotspot/share/gc/z/zServiceability.cpp b/src/hotspot/share/gc/z/zServiceability.cpp index 076d310ff717c..842c68cf65ee9 100644 --- a/src/hotspot/share/gc/z/zServiceability.cpp +++ b/src/hotspot/share/gc/z/zServiceability.cpp @@ -66,7 +66,7 @@ class ZGenerationCounters : public GenerationCounters { curr_capacity) {} void update_capacity(size_t capacity) { - update_all(capacity); + update_memory_state(capacity); } }; From 9c557117bf3d0848585ba14a6b1f2e2cab307503 Mon Sep 17 00:00:00 2001 From: suchismith1993 Date: Mon, 16 Jun 2025 12:59:39 -0400 Subject: [PATCH 2/6] Revert "update_capacity exists" This reverts commit cf2d66d598d90f1343d1ad7a4f30607c3374a0f8. --- .../gc/epsilon/epsilonMonitoringSupport.cpp | 12 ++++++------ src/hotspot/share/gc/g1/g1MonitoringSupport.cpp | 16 ++++++++-------- src/hotspot/share/gc/parallel/psOldGen.cpp | 6 +++--- src/hotspot/share/gc/parallel/psYoungGen.cpp | 8 ++++---- src/hotspot/share/gc/parallel/spaceCounters.hpp | 4 ++-- src/hotspot/share/gc/serial/cSpaceCounters.cpp | 2 +- src/hotspot/share/gc/serial/cSpaceCounters.hpp | 4 ++-- src/hotspot/share/gc/serial/defNewGeneration.cpp | 8 ++++---- .../share/gc/serial/tenuredGeneration.cpp | 4 ++-- .../share/gc/shared/generationCounters.cpp | 2 +- .../share/gc/shared/generationCounters.hpp | 4 ++-- src/hotspot/share/gc/shared/hSpaceCounters.cpp | 2 +- src/hotspot/share/gc/shared/hSpaceCounters.hpp | 4 ++-- .../shenandoah/shenandoahMonitoringSupport.cpp | 12 ++++++------ src/hotspot/share/gc/z/zServiceability.cpp | 2 +- 15 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp b/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp index f3c599af9d988..a2ae6f8a14a9d 100644 --- a/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2025, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2018, Red Hat, Inc. 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 @@ -75,7 +75,7 @@ class EpsilonSpaceCounters: public CHeapObj { FREE_C_HEAP_ARRAY(char, _name_space); } - inline void update_memory_state(size_t capacity, size_t used) { + inline void update_all(size_t capacity, size_t used) { _capacity->set_value(capacity); _used->set_value(used); } @@ -90,8 +90,8 @@ class EpsilonGenerationCounters : public GenerationCounters { _heap(heap) {}; - void update_memory_state() { - GenerationCounters::update_memory_state(_heap->capacity()); + void update_all() { + GenerationCounters::update_all(_heap->capacity()); } }; @@ -107,8 +107,8 @@ void EpsilonMonitoringSupport::update_counters() { EpsilonHeap* heap = EpsilonHeap::heap(); size_t used = heap->used(); size_t capacity = heap->capacity(); - _heap_counters->update_memory_state(); - _space_counters->update_memory_state(capacity, used); + _heap_counters->update_all(); + _space_counters->update_all(capacity, used); MetaspaceCounters::update_performance_counters(); } } diff --git a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp index 73694ae9d4b1a..6d1ffdb7c005a 100644 --- a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp +++ b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp @@ -56,13 +56,13 @@ class G1YoungGenerationCounters : public G1GenerationCounters { max_size, 0 /* curr_capacity */) { if (UsePerfData) { - update_memory_state(); + update_all(); } } - void update_memory_state() { + void update_all() { size_t committed = _monitoring_support->young_gen_committed(); - GenerationCounters::update_memory_state(committed); + GenerationCounters::update_all(committed); } }; @@ -77,13 +77,13 @@ class G1OldGenerationCounters : public G1GenerationCounters { max_size, 0 /* curr_capacity */) { if (UsePerfData) { - update_memory_state(); + update_all(); } } - void update_memory_state() { + void update_all() { size_t committed = _monitoring_support->old_gen_committed(); - GenerationCounters::update_memory_state(committed); + GenerationCounters::update_all(committed); } }; @@ -305,8 +305,8 @@ void G1MonitoringSupport::update_sizes() { _old_space_counters->update_capacity(_old_gen_committed); _old_space_counters->update_used(_old_gen_used); - _young_gen_counters->update_memory_state(); - _old_gen_counters->update_memory_state(); + _young_gen_counters->update_all(); + _old_gen_counters->update_all(); MetaspaceCounters::update_performance_counters(); } diff --git a/src/hotspot/share/gc/parallel/psOldGen.cpp b/src/hotspot/share/gc/parallel/psOldGen.cpp index 522fb85573e28..bc25683e00fa6 100644 --- a/src/hotspot/share/gc/parallel/psOldGen.cpp +++ b/src/hotspot/share/gc/parallel/psOldGen.cpp @@ -234,7 +234,7 @@ bool PSOldGen::expand_by(size_t bytes) { post_resize(); if (UsePerfData) { _space_counters->update_capacity(); - _gen_counters->update_memory_state(_virtual_space->committed_size()); + _gen_counters->update_all(_virtual_space->committed_size()); } } @@ -365,8 +365,8 @@ void PSOldGen::print_on(outputStream* st) const { void PSOldGen::update_counters() { if (UsePerfData) { - _space_counters->update_memory_state(); - _gen_counters->update_memory_state(_virtual_space->committed_size()); + _space_counters->update_all(); + _gen_counters->update_all(_virtual_space->committed_size()); } } diff --git a/src/hotspot/share/gc/parallel/psYoungGen.cpp b/src/hotspot/share/gc/parallel/psYoungGen.cpp index 4bdf57ad6f102..bf77a0dde930d 100644 --- a/src/hotspot/share/gc/parallel/psYoungGen.cpp +++ b/src/hotspot/share/gc/parallel/psYoungGen.cpp @@ -807,10 +807,10 @@ void PSYoungGen::post_resize() { void PSYoungGen::update_counters() { if (UsePerfData) { - _eden_counters->update_memory_state(); - _from_counters->update_memory_state(); - _to_counters->update_memory_state(); - _gen_counters->update_memory_state(_virtual_space->committed_size()); + _eden_counters->update_all(); + _from_counters->update_all(); + _to_counters->update_all(); + _gen_counters->update_all(_virtual_space->committed_size()); } } diff --git a/src/hotspot/share/gc/parallel/spaceCounters.hpp b/src/hotspot/share/gc/parallel/spaceCounters.hpp index af4478b758c3f..b33aac386a680 100644 --- a/src/hotspot/share/gc/parallel/spaceCounters.hpp +++ b/src/hotspot/share/gc/parallel/spaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, 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 @@ -60,7 +60,7 @@ class SpaceCounters: public CHeapObj { void update_used(); - inline void update_memory_state() { + inline void update_all() { update_used(); update_capacity(); } diff --git a/src/hotspot/share/gc/serial/cSpaceCounters.cpp b/src/hotspot/share/gc/serial/cSpaceCounters.cpp index b8a1ba2beb46a..f6bcee99423c4 100644 --- a/src/hotspot/share/gc/serial/cSpaceCounters.cpp +++ b/src/hotspot/share/gc/serial/cSpaceCounters.cpp @@ -77,7 +77,7 @@ void CSpaceCounters::update_used() { _used->set_value(_space->used()); } -void CSpaceCounters::update_memory_state() { +void CSpaceCounters::update_all() { update_used(); update_capacity(); } diff --git a/src/hotspot/share/gc/serial/cSpaceCounters.hpp b/src/hotspot/share/gc/serial/cSpaceCounters.hpp index 39c44925a91c9..b378f379afe9f 100644 --- a/src/hotspot/share/gc/serial/cSpaceCounters.hpp +++ b/src/hotspot/share/gc/serial/cSpaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, 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 @@ -56,7 +56,7 @@ class CSpaceCounters: public CHeapObj { void update_capacity(); void update_used(); - void update_memory_state(); + void update_all(); const char* name_space() const { return _name_space; } }; diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index 3d2af57d4dcf2..61b0ccad19163 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -811,10 +811,10 @@ void DefNewGeneration::gc_epilogue(bool full) { void DefNewGeneration::update_counters() { if (UsePerfData) { - _eden_counters->update_memory_state(); - _from_counters->update_memory_state(); - _to_counters->update_memory_state(); - _gen_counters->update_memory_state(_virtual_space.committed_size()); + _eden_counters->update_all(); + _from_counters->update_all(); + _to_counters->update_all(); + _gen_counters->update_all(_virtual_space.committed_size()); } } diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index bdc8b1d5cb68b..2725f1105f1bd 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -367,8 +367,8 @@ void TenuredGeneration::update_promote_stats() { void TenuredGeneration::update_counters() { if (UsePerfData) { - _space_counters->update_memory_state(); - _gen_counters->update_memory_state(_virtual_space.committed_size()); + _space_counters->update_all(); + _gen_counters->update_all(_virtual_space.committed_size()); } } diff --git a/src/hotspot/share/gc/shared/generationCounters.cpp b/src/hotspot/share/gc/shared/generationCounters.cpp index b841d9f584436..4af7b412aea55 100644 --- a/src/hotspot/share/gc/shared/generationCounters.cpp +++ b/src/hotspot/share/gc/shared/generationCounters.cpp @@ -67,7 +67,7 @@ GenerationCounters::~GenerationCounters() { FREE_C_HEAP_ARRAY(char, _name_space); } -void GenerationCounters::update_memory_state(size_t curr_capacity) { +void GenerationCounters::update_all(size_t curr_capacity) { _current_size->set_value(curr_capacity); } diff --git a/src/hotspot/share/gc/shared/generationCounters.hpp b/src/hotspot/share/gc/shared/generationCounters.hpp index ae4b0ba87315d..50672ab5d74f8 100644 --- a/src/hotspot/share/gc/shared/generationCounters.hpp +++ b/src/hotspot/share/gc/shared/generationCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -52,7 +52,7 @@ class GenerationCounters: public CHeapObj { ~GenerationCounters(); - void update_memory_state(size_t curr_capacity); + void update_all(size_t curr_capacity); const char* name_space() const { return _name_space; } }; diff --git a/src/hotspot/share/gc/shared/hSpaceCounters.cpp b/src/hotspot/share/gc/shared/hSpaceCounters.cpp index 26eaafb283dd2..818d7422fba45 100644 --- a/src/hotspot/share/gc/shared/hSpaceCounters.cpp +++ b/src/hotspot/share/gc/shared/hSpaceCounters.cpp @@ -77,7 +77,7 @@ void HSpaceCounters::update_used(size_t v) { _used->set_value(v); } -void HSpaceCounters::update_memory_state(size_t capacity, size_t used) { +void HSpaceCounters::update_all(size_t capacity, size_t used) { update_capacity(capacity); update_used(used); } diff --git a/src/hotspot/share/gc/shared/hSpaceCounters.hpp b/src/hotspot/share/gc/shared/hSpaceCounters.hpp index cc14ac7c8227e..01310e456f62c 100644 --- a/src/hotspot/share/gc/shared/hSpaceCounters.hpp +++ b/src/hotspot/share/gc/shared/hSpaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -54,7 +54,7 @@ class HSpaceCounters: public CHeapObj { void update_capacity(size_t v); void update_used(size_t v); - void update_memory_state(size_t capacity, size_t used); + void update_all(size_t capacity, size_t used); DEBUG_ONLY( // for security reasons, we do not allow arbitrary reads from diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp index 6dca1fbc8a685..6b72cbdd62bba 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Red Hat, Inc. All rights reserved. + * Copyright (c) 2015, 2019, Red Hat, Inc. 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 @@ class ShenandoahYoungGenerationCounters : public GenerationCounters { ShenandoahYoungGenerationCounters() : GenerationCounters("Young", 0, 0, 0, (size_t)0, (size_t)0) {}; - void update_memory_state() { + void update_all() { // no update } }; @@ -50,8 +50,8 @@ class ShenandoahGenerationCounters : public GenerationCounters { _heap(heap) {}; - void update_memory_state() { - GenerationCounters::update_memory_state(_heap->capacity()); + void update_all() { + GenerationCounters::update_all(_heap->capacity()); } }; @@ -98,8 +98,8 @@ void ShenandoahMonitoringSupport::update_counters() { ShenandoahHeap* heap = ShenandoahHeap::heap(); size_t used = heap->used(); size_t capacity = heap->max_capacity(); - _heap_counters->update_memory_state(); - _space_counters->update_memory_state(capacity, used); + _heap_counters->update_all(); + _space_counters->update_all(capacity, used); _heap_region_counters->update(); MetaspaceCounters::update_performance_counters(); diff --git a/src/hotspot/share/gc/z/zServiceability.cpp b/src/hotspot/share/gc/z/zServiceability.cpp index 842c68cf65ee9..076d310ff717c 100644 --- a/src/hotspot/share/gc/z/zServiceability.cpp +++ b/src/hotspot/share/gc/z/zServiceability.cpp @@ -66,7 +66,7 @@ class ZGenerationCounters : public GenerationCounters { curr_capacity) {} void update_capacity(size_t capacity) { - update_memory_state(capacity); + update_all(capacity); } }; From 59839a66f155c5b973f798fc954a4a66dd142814 Mon Sep 17 00:00:00 2001 From: suchismith1993 Date: Tue, 17 Jun 2025 04:12:06 -0400 Subject: [PATCH 3/6] update capacity only for Generation counter --- src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp | 4 ++-- src/hotspot/share/gc/parallel/psOldGen.cpp | 2 +- src/hotspot/share/gc/parallel/psYoungGen.cpp | 2 +- src/hotspot/share/gc/serial/defNewGeneration.cpp | 2 +- src/hotspot/share/gc/serial/tenuredGeneration.cpp | 2 +- src/hotspot/share/gc/shared/generationCounters.cpp | 2 +- src/hotspot/share/gc/shared/generationCounters.hpp | 4 ++-- .../share/gc/shenandoah/shenandoahMonitoringSupport.cpp | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp b/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp index a2ae6f8a14a9d..c9325de55cdfb 100644 --- a/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2025, Red Hat, Inc. 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 @@ -91,7 +91,7 @@ class EpsilonGenerationCounters : public GenerationCounters { {}; void update_all() { - GenerationCounters::update_all(_heap->capacity()); + GenerationCounters::update_capacity(_heap->capacity()); } }; diff --git a/src/hotspot/share/gc/parallel/psOldGen.cpp b/src/hotspot/share/gc/parallel/psOldGen.cpp index bc25683e00fa6..94f9700fe504f 100644 --- a/src/hotspot/share/gc/parallel/psOldGen.cpp +++ b/src/hotspot/share/gc/parallel/psOldGen.cpp @@ -234,7 +234,7 @@ bool PSOldGen::expand_by(size_t bytes) { post_resize(); if (UsePerfData) { _space_counters->update_capacity(); - _gen_counters->update_all(_virtual_space->committed_size()); + _gen_counters->update_capacity(_virtual_space->committed_size()); } } diff --git a/src/hotspot/share/gc/parallel/psYoungGen.cpp b/src/hotspot/share/gc/parallel/psYoungGen.cpp index bf77a0dde930d..4024109a4a033 100644 --- a/src/hotspot/share/gc/parallel/psYoungGen.cpp +++ b/src/hotspot/share/gc/parallel/psYoungGen.cpp @@ -810,7 +810,7 @@ void PSYoungGen::update_counters() { _eden_counters->update_all(); _from_counters->update_all(); _to_counters->update_all(); - _gen_counters->update_all(_virtual_space->committed_size()); + _gen_counters->update_capacity(_virtual_space->committed_size()); } } diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index 61b0ccad19163..cb36207ff4735 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -814,7 +814,7 @@ void DefNewGeneration::update_counters() { _eden_counters->update_all(); _from_counters->update_all(); _to_counters->update_all(); - _gen_counters->update_all(_virtual_space.committed_size()); + _gen_counters->update_capacity(_virtual_space.committed_size()); } } diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index 2725f1105f1bd..589e670a2e436 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -368,7 +368,7 @@ void TenuredGeneration::update_promote_stats() { void TenuredGeneration::update_counters() { if (UsePerfData) { _space_counters->update_all(); - _gen_counters->update_all(_virtual_space.committed_size()); + _gen_counters->update_capacity(_virtual_space.committed_size()); } } diff --git a/src/hotspot/share/gc/shared/generationCounters.cpp b/src/hotspot/share/gc/shared/generationCounters.cpp index 4af7b412aea55..f6bbc1c261855 100644 --- a/src/hotspot/share/gc/shared/generationCounters.cpp +++ b/src/hotspot/share/gc/shared/generationCounters.cpp @@ -67,7 +67,7 @@ GenerationCounters::~GenerationCounters() { FREE_C_HEAP_ARRAY(char, _name_space); } -void GenerationCounters::update_all(size_t curr_capacity) { +void GenerationCounters::update_capacity(size_t curr_capacity) { _current_size->set_value(curr_capacity); } diff --git a/src/hotspot/share/gc/shared/generationCounters.hpp b/src/hotspot/share/gc/shared/generationCounters.hpp index 50672ab5d74f8..cb835b44e259c 100644 --- a/src/hotspot/share/gc/shared/generationCounters.hpp +++ b/src/hotspot/share/gc/shared/generationCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -52,7 +52,7 @@ class GenerationCounters: public CHeapObj { ~GenerationCounters(); - void update_all(size_t curr_capacity); + void update_capacity(size_t curr_capacity); const char* name_space() const { return _name_space; } }; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp index 6b72cbdd62bba..dab5e65389ebd 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved. + * Copyright (c) 2015, 2025, Red Hat, Inc. 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 @@ -51,7 +51,7 @@ class ShenandoahGenerationCounters : public GenerationCounters { {}; void update_all() { - GenerationCounters::update_all(_heap->capacity()); + GenerationCounters::update_capacity(_heap->capacity()); } }; From 88c4160204e90a6e55e429152bb602394355a563 Mon Sep 17 00:00:00 2001 From: suchismith1993 Date: Tue, 17 Jun 2025 04:25:12 -0400 Subject: [PATCH 4/6] psOldGen --- src/hotspot/share/gc/parallel/psOldGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/parallel/psOldGen.cpp b/src/hotspot/share/gc/parallel/psOldGen.cpp index 94f9700fe504f..cedad78be3059 100644 --- a/src/hotspot/share/gc/parallel/psOldGen.cpp +++ b/src/hotspot/share/gc/parallel/psOldGen.cpp @@ -366,7 +366,7 @@ void PSOldGen::print_on(outputStream* st) const { void PSOldGen::update_counters() { if (UsePerfData) { _space_counters->update_all(); - _gen_counters->update_all(_virtual_space->committed_size()); + _gen_counters->update_capacity(_virtual_space->committed_size()); } } From bd26817c8855a08ddc2fcc71dc310695d29b9cb3 Mon Sep 17 00:00:00 2001 From: suchismith1993 Date: Tue, 17 Jun 2025 04:28:37 -0400 Subject: [PATCH 5/6] update zgenerationcounter --- src/hotspot/share/gc/z/zServiceability.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/hotspot/share/gc/z/zServiceability.cpp b/src/hotspot/share/gc/z/zServiceability.cpp index 076d310ff717c..7afa73245960f 100644 --- a/src/hotspot/share/gc/z/zServiceability.cpp +++ b/src/hotspot/share/gc/z/zServiceability.cpp @@ -65,9 +65,6 @@ class ZGenerationCounters : public GenerationCounters { max_capacity, curr_capacity) {} - void update_capacity(size_t capacity) { - update_all(capacity); - } }; // Class to expose perf counters used by jstat. From 7bb69a1d51456f517a8b0a33b284c296e32cdd78 Mon Sep 17 00:00:00 2001 From: suchismith1993 Date: Tue, 17 Jun 2025 10:55:17 -0400 Subject: [PATCH 6/6] g1Monitoring --- src/hotspot/share/gc/g1/g1MonitoringSupport.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp index 6d1ffdb7c005a..26364705a9d08 100644 --- a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp +++ b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp @@ -62,7 +62,7 @@ class G1YoungGenerationCounters : public G1GenerationCounters { void update_all() { size_t committed = _monitoring_support->young_gen_committed(); - GenerationCounters::update_all(committed); + GenerationCounters::update_capacity(committed); } }; @@ -83,7 +83,7 @@ class G1OldGenerationCounters : public G1GenerationCounters { void update_all() { size_t committed = _monitoring_support->old_gen_committed(); - GenerationCounters::update_all(committed); + GenerationCounters::update_capacity(committed); } };