Skip to content

Commit

Permalink
8327365: Inline and remove GCStats
Browse files Browse the repository at this point in the history
Reviewed-by: gli, tschatzl
  • Loading branch information
albertnetymk committed Mar 6, 2024
1 parent 326c91e commit ae5e3fd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 97 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 0 additions & 14 deletions src/hotspot/share/gc/serial/generation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
class DefNewGeneration;
class GCMemoryManager;
class ContiguousSpace;

class OopClosure;
class GCStats;

class Generation: public CHeapObj<mtGC> {
friend class VMStructs;
Expand All @@ -73,9 +71,6 @@ class Generation: public CHeapObj<mtGC> {
// Performance Counters
CollectorCounters* _gc_counters;

// Statistics for garbage collection
GCStats* _gc_stats;

// Initialize the generation.
Generation(ReservedSpace rs, size_t initial_byte_size);

Expand Down Expand Up @@ -168,15 +163,6 @@ class Generation: public CHeapObj<mtGC> {
// 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;
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/serial/tenuredGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
}
}
}
Expand All @@ -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 ")",
Expand Down
10 changes: 7 additions & 3 deletions src/hotspot/share/gc/serial/tenuredGeneration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand All @@ -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; }
Expand Down Expand Up @@ -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.
Expand Down
30 changes: 0 additions & 30 deletions src/hotspot/share/gc/shared/gcStats.cpp

This file was deleted.

42 changes: 0 additions & 42 deletions src/hotspot/share/gc/shared/gcStats.hpp

This file was deleted.

1 comment on commit ae5e3fd

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.