8028787: tmtools/jstat/gcoldcapacity/jstat_gcoldcapacity02 fails nsk.share.Failure: OGC < OGCMN in RT_Baseline
Summary: Passing the min and max size of the generation into the counter instead of using the space to estimate sizes.
Reviewed-by: stefank, tschatzl
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Aug 27 09:47:06 2014 +0200
@@ -328,9 +328,11 @@
void ConcurrentMarkSweepGeneration::initialize_performance_counters() {
const char* gen_name = "old";
+ GenCollectorPolicy* gcp = (GenCollectorPolicy*) GenCollectedHeap::heap()->collector_policy();
// Generation Counters - generation 1, 1 subspace
- _gen_counters = new GenerationCounters(gen_name, 1, 1, &_virtual_space);
+ _gen_counters = new GenerationCounters(gen_name, 1, 1,
+ gcp->min_old_size(), gcp->max_old_size(), &_virtual_space);
_space_counters = new GSpaceCounters(gen_name, 0,
_virtual_space.reserved_size(),
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGenerationCounters.cpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGenerationCounters.cpp Wed Aug 27 09:47:06 2014 +0200
@@ -30,6 +30,8 @@
PSGenerationCounters::PSGenerationCounters(const char* name,
int ordinal, int spaces,
+ size_t min_capacity,
+ size_t max_capacity,
PSVirtualSpace* v):
_ps_virtual_space(v) {
@@ -52,11 +54,11 @@
cname = PerfDataManager::counter_name(_name_space, "minCapacity");
PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
- _ps_virtual_space->committed_size(), CHECK);
+ min_capacity, CHECK);
cname = PerfDataManager::counter_name(_name_space, "maxCapacity");
PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
- _ps_virtual_space->reserved_size(), CHECK);
+ max_capacity, CHECK);
cname = PerfDataManager::counter_name(_name_space, "capacity");
_current_size = PerfDataManager::create_variable(SUN_GC, cname,
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGenerationCounters.hpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGenerationCounters.hpp Wed Aug 27 09:47:06 2014 +0200
@@ -41,7 +41,7 @@
public:
PSGenerationCounters(const char* name, int ordinal, int spaces,
- PSVirtualSpace* v);
+ size_t min_capacity, size_t max_capacity, PSVirtualSpace* v);
void update_all() {
assert(_virtual_space == NULL, "Only one should be in use");
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp Wed Aug 27 09:47:06 2014 +0200
@@ -149,8 +149,8 @@
void PSOldGen::initialize_performance_counters(const char* perf_data_name, int level) {
// Generation Counters, generation 'level', 1 subspace
- _gen_counters = new PSGenerationCounters(perf_data_name, level, 1,
- virtual_space());
+ _gen_counters = new PSGenerationCounters(perf_data_name, level, 1, _min_gen_size,
+ _max_gen_size, virtual_space());
_space_counters = new SpaceCounters(perf_data_name, 0,
virtual_space()->reserved_size(),
_object_space, _gen_counters);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp Wed Aug 27 09:47:06 2014 +0200
@@ -101,7 +101,8 @@
}
// Generation Counters - generation 0, 3 subspaces
- _gen_counters = new PSGenerationCounters("new", 0, 3, _virtual_space);
+ _gen_counters = new PSGenerationCounters("new", 0, 3, _min_gen_size,
+ _max_gen_size, _virtual_space);
// Compute maximum space sizes for performance counters
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
--- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.cpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.cpp Wed Aug 27 09:47:06 2014 +0200
@@ -62,11 +62,12 @@
GenerationCounters::GenerationCounters(const char* name,
int ordinal, int spaces,
+ size_t min_capacity, size_t max_capacity,
VirtualSpace* v)
: _virtual_space(v) {
assert(v != NULL, "don't call this constructor if v == NULL");
initialize(name, ordinal, spaces,
- v->committed_size(), v->reserved_size(), v->committed_size());
+ min_capacity, max_capacity, v->committed_size());
}
GenerationCounters::GenerationCounters(const char* name,
--- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp Wed Aug 27 09:47:06 2014 +0200
@@ -66,7 +66,7 @@
public:
GenerationCounters(const char* name, int ordinal, int spaces,
- VirtualSpace* v);
+ size_t min_capacity, size_t max_capacity, VirtualSpace* v);
~GenerationCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp Wed Aug 27 09:47:06 2014 +0200
@@ -214,9 +214,11 @@
_max_eden_size = size - (2*_max_survivor_size);
// allocate the performance counters
+ GenCollectorPolicy* gcp = (GenCollectorPolicy*) GenCollectedHeap::heap()->collector_policy();
// Generation counters -- generation 0, 3 subspaces
- _gen_counters = new GenerationCounters("new", 0, 3, &_virtual_space);
+ _gen_counters = new GenerationCounters("new", 0, 3,
+ gcp->min_young_size(), gcp->max_young_size(), &_virtual_space);
_gc_counters = new CollectorCounters(policy, 0);
_eden_counters = new CSpaceCounters("eden", 0, _max_eden_size, _eden_space,
--- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp Wed Aug 27 09:22:22 2014 +0000
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp Wed Aug 27 09:47:06 2014 +0200
@@ -53,9 +53,11 @@
// initialize performance counters
const char* gen_name = "old";
+ GenCollectorPolicy* gcp = (GenCollectorPolicy*) GenCollectedHeap::heap()->collector_policy();
// Generation Counters -- generation 1, 1 subspace
- _gen_counters = new GenerationCounters(gen_name, 1, 1, &_virtual_space);
+ _gen_counters = new GenerationCounters(gen_name, 1, 1,
+ gcp->min_old_size(), gcp->max_old_size(), &_virtual_space);
_gc_counters = new CollectorCounters("MSC", 1);