8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3

Co-authored-by: Y. Srinivas Ramakrishna <ysr1729@gmail.com>
Reviewed-by: sjohanss, tschatzl
This commit is contained in:
Erik Helin 2017-11-27 10:51:31 +01:00
parent 677e5bdaed
commit 01e9cb7e23
9 changed files with 66 additions and 9 deletions

View File

@ -71,6 +71,6 @@ void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size,
}
void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
// initialize the policy counters - 2 collectors, 3 generations
_gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
// initialize the policy counters - 2 collectors, 2 generations
_gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 2);
}

View File

@ -52,7 +52,7 @@ G1DefaultPolicy::G1DefaultPolicy(STWGCTimer* gc_timer) :
_analytics(new G1Analytics(&_predictor)),
_mmu_tracker(new G1MMUTrackerQueue(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)),
_ihop_control(create_ihop_control(&_predictor)),
_policy_counters(new GCPolicyCounters("GarbageFirst", 1, 3)),
_policy_counters(new GCPolicyCounters("GarbageFirst", 1, 2)),
_young_list_fixed_length(0),
_short_lived_surv_rate_group(new SurvRateGroup()),
_survivor_surv_rate_group(new SurvRateGroup()),

View File

@ -105,9 +105,9 @@ jint ParallelScavengeHeap::initialize() {
(old_gen()->virtual_space()->high_boundary() ==
young_gen()->virtual_space()->low_boundary()),
"Boundaries must meet");
// initialize the policy counters - 2 collectors, 3 generations
// initialize the policy counters - 2 collectors, 2 generations
_gc_policy_counters =
new PSGCAdaptivePolicyCounters("ParScav:MSC", 2, 3, _size_policy);
new PSGCAdaptivePolicyCounters("ParScav:MSC", 2, 2, _size_policy);
// Set up the GCTaskManager
_gc_task_manager = GCTaskManager::create(ParallelGCThreads);

View File

@ -911,7 +911,7 @@ void MarkSweepPolicy::initialize_generations() {
}
void MarkSweepPolicy::initialize_gc_policy_counters() {
// Initialize the policy counters - 2 collectors, 3 generations.
_gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
// Initialize the policy counters - 2 collectors, 2 generations.
_gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 2);
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2017, 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.
*/
import static jdk.test.lib.Asserts.*;
import gc.testlibrary.PerfCounter;
import gc.testlibrary.PerfCounters;
/* @test TestGenerationPerfCounter
* @bug 8080345
* @requires vm.gc=="null"
* @library /test/lib /
* @summary Tests that the sun.gc.policy.generations returns 2 for all GCs.
* @modules java.base/jdk.internal.misc
* java.compiler
* java.management/sun.management
* jdk.internal.jvmstat/sun.jvmstat.monitor
* @run main/othervm -XX:+UsePerfData -XX:+UseSerialGC TestGenerationPerfCounter
* @run main/othervm -XX:+UsePerfData -XX:+UseParallelGC TestGenerationPerfCounter
* @run main/othervm -XX:+UsePerfData -XX:+UseG1GC TestGenerationPerfCounter
* @run main/othervm -XX:+UsePerfData -XX:+UseConcMarkSweepGC TestGenerationPerfCounter
*/
public class TestGenerationPerfCounter {
public static void main(String[] args) throws Exception {
long numGenerations =
PerfCounters.findByName("sun.gc.policy.generations").longValue();
assertEQ(numGenerations, 2L);
}
}

View File

@ -32,11 +32,13 @@ import jdk.test.lib.Platform;
import sun.management.ManagementFactoryHelper;
import static jdk.test.lib.Asserts.*;
import gc.testlibrary.PerfCounter;
import gc.testlibrary.PerfCounters;
/* @test TestMetaspacePerfCounters
* @bug 8014659
* @requires vm.gc=="null"
* @library /test/lib
* @library /test/lib /
* @summary Tests that performance counters for metaspace and compressed class
* space exists and works.
* @modules java.base/jdk.internal.misc

View File

@ -26,10 +26,12 @@ import java.lang.management.*;
import jdk.test.lib.Platform;
import static jdk.test.lib.Asserts.*;
import gc.testlibrary.PerfCounter;
import gc.testlibrary.PerfCounters;
/* @test TestPerfCountersAndMemoryPools
* @bug 8023476
* @library /test/lib
* @library /test/lib /
* @requires vm.gc.Serial
* @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
* report the same data.

View File

@ -21,6 +21,8 @@
* questions.
*/
package gc.testlibrary;
import sun.jvmstat.monitor.Monitor;
/**

View File

@ -21,6 +21,8 @@
* questions.
*/
package gc.testlibrary;
import sun.jvmstat.monitor.Monitor;
import sun.jvmstat.monitor.MonitorException;
import sun.jvmstat.monitor.MonitoredHost;