diff --git a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp index c8a15c2cb92..cfdb7e9eb29 100644 --- a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp +++ b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp @@ -49,7 +49,7 @@ PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size, gc_cost_ratio), _avg_major_pause(new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding)), _avg_base_footprint(new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight)), - _gc_stats(), + _avg_promoted(new AdaptivePaddedNoZeroDevAverage(AdaptiveSizePolicyWeight, PromotedPadding)), _major_pause_old_estimator(new LinearLeastSquareFit(AdaptiveSizePolicyWeight)), _major_pause_young_estimator(new LinearLeastSquareFit(AdaptiveSizePolicyWeight)), _latest_major_mutator_interval_seconds(0), diff --git a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp index 997a4784667..90e1e60db94 100644 --- a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp +++ b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp @@ -27,7 +27,6 @@ #include "gc/shared/adaptiveSizePolicy.hpp" #include "gc/shared/gcCause.hpp" -#include "gc/shared/gcStats.hpp" #include "gc/shared/gcUtil.hpp" #include "utilities/align.hpp" @@ -72,8 +71,8 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy { // Footprint statistics AdaptiveWeightedAverage* _avg_base_footprint; - // Statistical data gathered for GC - GCStats _gc_stats; + // Statistics for promoted objs + AdaptivePaddedNoZeroDevAverage* _avg_promoted; // Variable for estimating the major and minor pause times. // These variables represent linear least-squares fits of @@ -166,7 +165,7 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy { public: // Accessors for use by performance counters AdaptivePaddedNoZeroDevAverage* avg_promoted() const { - return _gc_stats.avg_promoted(); + return _avg_promoted; } AdaptiveWeightedAverage* avg_base_footprint() const { return _avg_base_footprint; diff --git a/src/hotspot/share/gc/serial/generation.hpp b/src/hotspot/share/gc/serial/generation.hpp index 114ab3d6312..33ae773f7bf 100644 --- a/src/hotspot/share/gc/serial/generation.hpp +++ b/src/hotspot/share/gc/serial/generation.hpp @@ -51,9 +51,7 @@ class DefNewGeneration; class GCMemoryManager; class ContiguousSpace; - class OopClosure; -class GCStats; class Generation: public CHeapObj { friend class VMStructs; @@ -73,9 +71,6 @@ class Generation: public CHeapObj { // Performance Counters CollectorCounters* _gc_counters; - // Statistics for garbage collection - GCStats* _gc_stats; - // Initialize the generation. Generation(ReservedSpace rs, size_t initial_byte_size); @@ -168,15 +163,6 @@ class Generation: public CHeapObj { // still unsuccessful, return "null". virtual HeapWord* expand_and_allocate(size_t word_size, bool is_tlab) = 0; - // Generations may keep statistics about collection. This method - // updates those statistics. current_generation is the generation - // that was most recently collected. This allows the generation to - // decide what statistics are valid to collect. For example, the - // generation can decide to gather the amount of promoted data if - // the collection of the young generation has completed. - GCStats* gc_stats() const { return _gc_stats; } - virtual void update_gc_stats(Generation* current_generation, bool full) {} - // Printing virtual const char* name() const = 0; virtual const char* short_name() const = 0; diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index fe37d997549..61eed1994b9 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -308,7 +308,7 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs, _shrink_factor = ShrinkHeapInSteps ? 0 : 100; _capacity_at_prologue = 0; - _gc_stats = new GCStats(); + _avg_promoted = new AdaptivePaddedNoZeroDevAverage(AdaptiveSizePolicyWeight, PromotedPadding); // initialize performance counters @@ -390,7 +390,7 @@ void TenuredGeneration::update_gc_stats(Generation* current_generation, // also possible that no promotion was needed. if (used_before_gc >= _used_at_prologue) { size_t promoted_in_bytes = used_before_gc - _used_at_prologue; - gc_stats()->avg_promoted()->sample(promoted_in_bytes); + _avg_promoted->sample(promoted_in_bytes); } } } @@ -404,7 +404,7 @@ void TenuredGeneration::update_counters() { bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const { size_t available = max_contiguous_available(); - size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average(); + size_t av_promo = (size_t)_avg_promoted->padded_average(); bool res = (available >= av_promo) || (available >= max_promotion_in_bytes); log_trace(gc)("Tenured: promo attempt is%s safe: available(" SIZE_FORMAT ") %s av_promo(" SIZE_FORMAT "), max_promo(" SIZE_FORMAT ")", diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.hpp index b87926e0497..2700c888619 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.hpp @@ -27,7 +27,6 @@ #include "gc/serial/cSpaceCounters.hpp" #include "gc/serial/generation.hpp" -#include "gc/shared/gcStats.hpp" #include "gc/shared/generationCounters.hpp" #include "gc/shared/space.hpp" #include "utilities/macros.hpp" @@ -71,6 +70,10 @@ class TenuredGeneration: public Generation { GenerationCounters* _gen_counters; CSpaceCounters* _space_counters; + // Avg amount promoted; used for avoiding promotion undo + // This class does not update deviations if the sample is zero. + AdaptivePaddedNoZeroDevAverage* _avg_promoted; + // Attempt to expand the generation by "bytes". Expand by at a // minimum "expand_bytes". Return true if some amount (not // necessarily the full "bytes") was done. @@ -80,7 +83,8 @@ class TenuredGeneration: public Generation { void shrink(size_t bytes); void compute_new_size_inner(); - public: + +public: void compute_new_size(); TenuredSpace* space() const { return _the_space; } @@ -158,7 +162,7 @@ class TenuredGeneration: public Generation { // Statistics - virtual void update_gc_stats(Generation* current_generation, bool full); + void update_gc_stats(Generation* current_generation, bool full); // Returns true if promotions of the specified amount are // likely to succeed without a promotion failure. diff --git a/src/hotspot/share/gc/shared/gcStats.cpp b/src/hotspot/share/gc/shared/gcStats.cpp deleted file mode 100644 index 42307e974d2..00000000000 --- a/src/hotspot/share/gc/shared/gcStats.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * 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. - * - */ - -#include "precompiled.hpp" -#include "gc/shared/gcStats.hpp" -#include "gc/shared/gcUtil.hpp" -#include "gc/shared/gc_globals.hpp" - -GCStats::GCStats() : _avg_promoted(new AdaptivePaddedNoZeroDevAverage(AdaptiveSizePolicyWeight, PromotedPadding)) {} diff --git a/src/hotspot/share/gc/shared/gcStats.hpp b/src/hotspot/share/gc/shared/gcStats.hpp deleted file mode 100644 index 1bd34f06ec4..00000000000 --- a/src/hotspot/share/gc/shared/gcStats.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * 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. - * - */ - -#ifndef SHARE_GC_SHARED_GCSTATS_HPP -#define SHARE_GC_SHARED_GCSTATS_HPP - -#include "gc/shared/gcUtil.hpp" - -class GCStats : public CHeapObj { - protected: - // Avg amount promoted; used for avoiding promotion undo - // This class does not update deviations if the sample is zero. - AdaptivePaddedNoZeroDevAverage* _avg_promoted; - - public: - GCStats(); - - AdaptivePaddedNoZeroDevAverage* avg_promoted() const { return _avg_promoted; } -}; - -#endif // SHARE_GC_SHARED_GCSTATS_HPP