Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/hotspot/share/gc/epsilon/epsilonHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,10 @@ void EpsilonHeap::print_heap_info(size_t used) const {
}

void EpsilonHeap::print_metaspace_info() const {
size_t reserved = MetaspaceUtils::reserved_bytes();
size_t committed = MetaspaceUtils::committed_bytes();
size_t used = MetaspaceUtils::used_bytes();
MetaspaceCombinedStats stats = MetaspaceUtils::get_combined_statistics();
size_t reserved = stats.reserved();
size_t committed = stats.committed();
size_t used = stats.used();

if (reserved != 0) {
log_info(gc, metaspace)("Metaspace: " SIZE_FORMAT "%s reserved, " SIZE_FORMAT "%s (%.2f%%) committed, "
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ void EpsilonMonitoringSupport::update_counters() {
_heap_counters->update_all();
_space_counters->update_all(capacity, used);
MetaspaceCounters::update_performance_counters();
CompressedClassSpaceCounters::update_performance_counters();
}
}

1 change: 1 addition & 0 deletions src/hotspot/share/gc/g1/g1HeapTransition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ G1HeapTransition::Data::Data(G1CollectedHeap* g1_heap) :
_old_length(g1_heap->old_regions_count()),
_archive_length(g1_heap->archive_regions_count()),
_humongous_length(g1_heap->humongous_regions_count()),
_meta_sizes(MetaspaceUtils::get_combined_statistics()),
_eden_length_per_node(NULL),
_survivor_length_per_node(NULL) {

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1HeapTransition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define SHARE_GC_G1_G1HEAPTRANSITION_HPP

#include "gc/shared/plab.hpp"
#include "memory/metaspace/metaspaceSizesSnapshot.hpp"
#include "memory/metaspaceStats.hpp"

class G1CollectedHeap;

Expand All @@ -37,7 +37,7 @@ class G1HeapTransition {
size_t _old_length;
size_t _archive_length;
size_t _humongous_length;
const metaspace::MetaspaceSizesSnapshot _meta_sizes;
const MetaspaceCombinedStats _meta_sizes;

// Only includes current eden regions.
uint* _eden_length_per_node;
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/g1/g1MonitoringSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ void G1MonitoringSupport::update_sizes() {
_old_gen_counters->update_all();

MetaspaceCounters::update_performance_counters();
CompressedClassSpaceCounters::update_performance_counters();
}
}

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ void ParallelScavengeHeap::update_counters() {
young_gen()->update_counters();
old_gen()->update_counters();
MetaspaceCounters::update_performance_counters();
CompressedClassSpaceCounters::update_performance_counters();
}

size_t ParallelScavengeHeap::capacity() const {
Expand Down
17 changes: 2 additions & 15 deletions src/hotspot/share/gc/shared/collectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,25 +127,12 @@ GCHeapSummary CollectedHeap::create_heap_summary() {
}

MetaspaceSummary CollectedHeap::create_metaspace_summary() {
const MetaspaceSizes meta_space(
MetaspaceUtils::committed_bytes(),
MetaspaceUtils::used_bytes(),
MetaspaceUtils::reserved_bytes());
const MetaspaceSizes data_space(
MetaspaceUtils::committed_bytes(Metaspace::NonClassType),
MetaspaceUtils::used_bytes(Metaspace::NonClassType),
MetaspaceUtils::reserved_bytes(Metaspace::NonClassType));
const MetaspaceSizes class_space(
MetaspaceUtils::committed_bytes(Metaspace::ClassType),
MetaspaceUtils::used_bytes(Metaspace::ClassType),
MetaspaceUtils::reserved_bytes(Metaspace::ClassType));

const MetaspaceChunkFreeListSummary& ms_chunk_free_list_summary =
MetaspaceUtils::chunk_free_list_summary(Metaspace::NonClassType);
const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary =
MetaspaceUtils::chunk_free_list_summary(Metaspace::ClassType);

return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), meta_space, data_space, class_space,
return MetaspaceSummary(MetaspaceGC::capacity_until_GC(),
MetaspaceUtils::get_combined_statistics(),
ms_chunk_free_list_summary, class_chunk_free_list_summary);
}

Expand Down
36 changes: 6 additions & 30 deletions src/hotspot/share/gc/shared/gcHeapSummary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define SHARE_GC_SHARED_GCHEAPSUMMARY_HPP

#include "memory/allocation.hpp"
#include "memory/metaspaceStats.hpp"
#include "memory/metaspaceChunkFreeListSummary.hpp"

class VirtualSpaceSummary : public StackObj {
Expand Down Expand Up @@ -61,21 +62,6 @@ class SpaceSummary : public StackObj {
size_t size() const { return (uintptr_t)_end - (uintptr_t)_start; }
};

class MetaspaceSizes : public StackObj {
size_t _committed;
size_t _used;
size_t _reserved;

public:
MetaspaceSizes() : _committed(0), _used(0), _reserved(0) {}
MetaspaceSizes(size_t committed, size_t used, size_t reserved) :
_committed(committed), _used(used), _reserved(reserved) {}

size_t committed() const { return _committed; }
size_t used() const { return _used; }
size_t reserved() const { return _reserved; }
};

class GCHeapSummary;
class PSHeapSummary;
class G1HeapSummary;
Expand Down Expand Up @@ -147,39 +133,29 @@ class G1HeapSummary : public GCHeapSummary {

class MetaspaceSummary : public StackObj {
size_t _capacity_until_GC;
MetaspaceSizes _meta_space;
MetaspaceSizes _data_space;
MetaspaceSizes _class_space;
MetaspaceCombinedStats _stats;
MetaspaceChunkFreeListSummary _metaspace_chunk_free_list_summary;
MetaspaceChunkFreeListSummary _class_chunk_free_list_summary;

public:
MetaspaceSummary() :
_capacity_until_GC(0),
_meta_space(),
_data_space(),
_class_space(),
_stats(),
_metaspace_chunk_free_list_summary(),
_class_chunk_free_list_summary()
{}
MetaspaceSummary(size_t capacity_until_GC,
const MetaspaceSizes& meta_space,
const MetaspaceSizes& data_space,
const MetaspaceSizes& class_space,
const MetaspaceCombinedStats& stats,
const MetaspaceChunkFreeListSummary& metaspace_chunk_free_list_summary,
const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary) :
_capacity_until_GC(capacity_until_GC),
_meta_space(meta_space),
_data_space(data_space),
_class_space(class_space),
_stats(stats),
_metaspace_chunk_free_list_summary(metaspace_chunk_free_list_summary),
_class_chunk_free_list_summary(class_chunk_free_list_summary)
{}

size_t capacity_until_GC() const { return _capacity_until_GC; }
const MetaspaceSizes& meta_space() const { return _meta_space; }
const MetaspaceSizes& data_space() const { return _data_space; }
const MetaspaceSizes& class_space() const { return _class_space; }
const MetaspaceCombinedStats& stats() const { return _stats; }

const MetaspaceChunkFreeListSummary& metaspace_chunk_free_list_summary() const {
return _metaspace_chunk_free_list_summary;
Expand Down
10 changes: 4 additions & 6 deletions src/hotspot/share/gc/shared/gcTraceSend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,11 @@ void GCTracer::send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary
heap_summary.accept(&visitor);
}

static JfrStructMetaspaceSizes to_struct(const MetaspaceSizes& sizes) {
static JfrStructMetaspaceSizes to_struct(const MetaspaceStats& sizes) {
JfrStructMetaspaceSizes meta_sizes;

meta_sizes.set_committed(sizes.committed());
meta_sizes.set_used(sizes.used());
meta_sizes.set_reserved(sizes.reserved());

return meta_sizes;
}

Expand All @@ -281,9 +279,9 @@ void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceS
e.set_gcId(GCId::current());
e.set_when((u1) when);
e.set_gcThreshold(meta_space_summary.capacity_until_GC());
e.set_metaspace(to_struct(meta_space_summary.meta_space()));
e.set_dataSpace(to_struct(meta_space_summary.data_space()));
e.set_classSpace(to_struct(meta_space_summary.class_space()));
e.set_metaspace(to_struct(meta_space_summary.stats())); // total stats (class + nonclass)
e.set_dataSpace(to_struct(meta_space_summary.stats().non_class_space_stats())); // "dataspace" aka non-class space
e.set_classSpace(to_struct(meta_space_summary.stats().class_space_stats()));
e.commit();
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/gc/shared/genCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
#include "gc/shared/weakProcessor.hpp"
#include "gc/shared/workgroup.hpp"
#include "memory/iterator.hpp"
#include "memory/metaspace/metaspaceSizesSnapshot.hpp"
#include "memory/metaspaceCounters.hpp"
#include "memory/metaspaceUtils.hpp"
#include "memory/resourceArea.hpp"
Expand Down Expand Up @@ -1228,7 +1227,6 @@ void GenCollectedHeap::gc_epilogue(bool full) {
generation_iterate(&blk, false); // not old-to-young.

MetaspaceCounters::update_performance_counters();
CompressedClassSpaceCounters::update_performance_counters();
};

#ifndef PRODUCT
Expand Down
10 changes: 6 additions & 4 deletions src/hotspot/share/gc/shared/preGCValues.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#ifndef SHARE_GC_SHARED_PREGCVALUES_HPP
#define SHARE_GC_SHARED_PREGCVALUES_HPP

#include "memory/metaspace/metaspaceSizesSnapshot.hpp"
#include "memory/metaspaceStats.hpp"
#include "memory/metaspaceUtils.hpp"

// Simple class for storing info about the heap at the start of GC, to be used
// after GC for comparison/printing.
Expand All @@ -47,7 +48,8 @@ class PreGenGCValues {
_from_used(from_used),
_from_capacity(from_capacity),
_old_gen_used(old_gen_used),
_old_gen_capacity(old_gen_capacity) { }
_old_gen_capacity(old_gen_capacity),
_meta_sizes(MetaspaceUtils::get_combined_statistics()){ }

size_t young_gen_used() const { return _young_gen_used; }
size_t young_gen_capacity() const { return _young_gen_capacity; }
Expand All @@ -57,7 +59,7 @@ class PreGenGCValues {
size_t from_capacity() const { return _from_capacity; }
size_t old_gen_used() const { return _old_gen_used; }
size_t old_gen_capacity() const { return _old_gen_capacity; }
const metaspace::MetaspaceSizesSnapshot& metaspace_sizes() const { return _meta_sizes; }
const MetaspaceCombinedStats& metaspace_sizes() const { return _meta_sizes; }

private:
const size_t _young_gen_used;
Expand All @@ -68,7 +70,7 @@ class PreGenGCValues {
const size_t _from_capacity;
const size_t _old_gen_used;
const size_t _old_gen_capacity;
const metaspace::MetaspaceSizesSnapshot _meta_sizes;
const MetaspaceCombinedStats _meta_sizes;
};

#endif // SHARE_GC_SHARED_PREGCVALUES_HPP
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp"
#include "memory/iterator.hpp"
#include "memory/metaspaceUtils.hpp"
#include "memory/metaspaceStats.hpp"
#include "memory/universe.hpp"
#include "runtime/atomic.hpp"

Expand Down Expand Up @@ -187,8 +188,7 @@ void ShenandoahControlThread::run_service() {

heap->reset_bytes_allocated_since_gc_start();

// Use default constructor to snapshot the Metaspace state before GC.
metaspace::MetaspaceSizesSnapshot meta_sizes;
MetaspaceCombinedStats meta_sizes = MetaspaceUtils::get_combined_statistics();

// If GC was requested, we are sampling the counters even without actual triggers
// from allocation machinery. This captures GC phases more accurately.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,5 @@ void ShenandoahMonitoringSupport::update_counters() {
_heap_region_counters->update();

MetaspaceCounters::update_performance_counters();
CompressedClassSpaceCounters::update_performance_counters();
}
}
1 change: 0 additions & 1 deletion src/hotspot/share/gc/z/zServiceability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ void ZServiceabilityCounters::update_sizes() {
_space_counters.update_used(used);

MetaspaceCounters::update_performance_counters();
CompressedClassSpaceCounters::update_performance_counters();
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/hotspot/share/gc/z/zStat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,12 +1211,13 @@ void ZStatNMethods::print() {
// Stat metaspace
//
void ZStatMetaspace::print() {
MetaspaceCombinedStats stats = MetaspaceUtils::get_combined_statistics();
log_info(gc, metaspace)("Metaspace: "
SIZE_FORMAT "M used, "
SIZE_FORMAT "M committed, " SIZE_FORMAT "M reserved",
MetaspaceUtils::used_bytes() / M,
MetaspaceUtils::committed_bytes() / M,
MetaspaceUtils::reserved_bytes() / M);
stats.used() / M,
stats.committed() / M,
stats.reserved() / M);
}

//
Expand Down
Loading