0N/A/*
1879N/A * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP
1879N/A#define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP
1879N/A
1879N/A#include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
1879N/A#include "gc_implementation/shared/gcAdaptivePolicyCounters.hpp"
1879N/A#include "gc_implementation/shared/gcStats.hpp"
1879N/A#include "runtime/perfData.hpp"
1879N/A
0N/A// CMSGCAdaptivePolicyCounters is a holder class for performance counters
0N/A// that track the data and decisions for the ergonomics policy for the
0N/A// concurrent mark sweep collector
0N/A
0N/Aclass CMSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {
0N/A friend class VMStructs;
0N/A
0N/A private:
0N/A
0N/A // Capacity of tenured generation recorded at the end of
0N/A // any collection.
0N/A PerfVariable* _cms_capacity_counter; // Make this common with PS _old_capacity
0N/A
0N/A // Average stop-the-world pause time for both initial and
0N/A // remark pauses sampled at the end of the checkpointRootsFinalWork.
0N/A PerfVariable* _avg_cms_STW_time_counter;
0N/A // Average stop-the-world (STW) GC cost for the STW pause time
0N/A // _avg_cms_STW_time_counter.
0N/A PerfVariable* _avg_cms_STW_gc_cost_counter;
0N/A
0N/A#ifdef NOT_PRODUCT
0N/A // These are useful to see how the most recent values of these
0N/A // counters compare to their respective averages but
0N/A // do not control behavior.
0N/A PerfVariable* _initial_pause_counter;
0N/A PerfVariable* _remark_pause_counter;
0N/A#endif
0N/A
0N/A // Average of the initial marking pause for a concurrent collection.
0N/A PerfVariable* _avg_initial_pause_counter;
0N/A // Average of the remark pause for a concurrent collection.
0N/A PerfVariable* _avg_remark_pause_counter;
0N/A
0N/A // Average for the sum of all the concurrent times per collection.
0N/A PerfVariable* _avg_concurrent_time_counter;
0N/A // Average for the time between the most recent end of a
0N/A // concurrent collection and the beginning of the next
0N/A // concurrent collection.
0N/A PerfVariable* _avg_concurrent_interval_counter;
0N/A // Average of the concurrent GC costs based on _avg_concurrent_time_counter
0N/A // and _avg_concurrent_interval_counter.
0N/A PerfVariable* _avg_concurrent_gc_cost_counter;
0N/A
0N/A // Average of the free space in the tenured generation at the
0N/A // end of the sweep of the tenured generation.
0N/A PerfVariable* _avg_cms_free_counter;
0N/A // Average of the free space in the tenured generation at the
605N/A // start of the sweep of the tenured generation.
0N/A PerfVariable* _avg_cms_free_at_sweep_counter;
0N/A // Average of the free space in the tenured generation at the
0N/A // after any resizing of the tenured generation at the end
0N/A // of a collection of the tenured generation.
0N/A PerfVariable* _avg_cms_promo_counter;
0N/A
0N/A // Average of the mark-sweep-compact (MSC) pause time for a collection
0N/A // of the tenured generation.
0N/A PerfVariable* _avg_msc_pause_counter;
0N/A // Average for the time between the most recent end of a
0N/A // MSC collection and the beginning of the next
0N/A // MSC collection.
0N/A PerfVariable* _avg_msc_interval_counter;
0N/A // Average for the GC cost of a MSC collection based on
0N/A // _avg_msc_pause_counter and _avg_msc_interval_counter.
0N/A PerfVariable* _msc_gc_cost_counter;
0N/A
0N/A // Average of the mark-sweep (MS) pause time for a collection
0N/A // of the tenured generation.
0N/A PerfVariable* _avg_ms_pause_counter;
0N/A // Average for the time between the most recent end of a
0N/A // MS collection and the beginning of the next
0N/A // MS collection.
0N/A PerfVariable* _avg_ms_interval_counter;
0N/A // Average for the GC cost of a MS collection based on
0N/A // _avg_ms_pause_counter and _avg_ms_interval_counter.
0N/A PerfVariable* _ms_gc_cost_counter;
0N/A
0N/A // Average of the bytes promoted per minor collection.
0N/A PerfVariable* _promoted_avg_counter;
0N/A // Average of the deviation of the promoted average
0N/A PerfVariable* _promoted_avg_dev_counter;
0N/A // Padded average of the bytes promoted per minor colleciton
0N/A PerfVariable* _promoted_padded_avg_counter;
0N/A
0N/A // See description of the _change_young_gen_for_maj_pauses
0N/A // variable recently in cmsAdaptiveSizePolicy.hpp.
0N/A PerfVariable* _change_young_gen_for_maj_pauses_counter;
0N/A
0N/A // See descriptions of _remark_pause_old_slope, _initial_pause_old_slope,
0N/A // etc. variables recently in cmsAdaptiveSizePolicy.hpp.
0N/A PerfVariable* _remark_pause_old_slope_counter;
0N/A PerfVariable* _initial_pause_old_slope_counter;
0N/A PerfVariable* _remark_pause_young_slope_counter;
0N/A PerfVariable* _initial_pause_young_slope_counter;
0N/A
0N/A CMSAdaptiveSizePolicy* cms_size_policy() {
0N/A assert(_size_policy->kind() ==
0N/A AdaptiveSizePolicy::_gc_cms_adaptive_size_policy,
0N/A "Wrong size policy");
0N/A return (CMSAdaptiveSizePolicy*)_size_policy;
0N/A }
0N/A
0N/A inline void update_avg_cms_STW_time_counter() {
0N/A _avg_cms_STW_time_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_cms_STW_time()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_avg_cms_STW_gc_cost_counter() {
0N/A _avg_cms_STW_gc_cost_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_cms_STW_gc_cost()->average() * 100.0));
0N/A }
0N/A
0N/A inline void update_avg_initial_pause_counter() {
0N/A _avg_initial_pause_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_initial_pause()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A#ifdef NOT_PRODUCT
0N/A inline void update_avg_remark_pause_counter() {
0N/A _avg_remark_pause_counter->set_value(
0N/A (jlong) (cms_size_policy()-> avg_remark_pause()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_initial_pause_counter() {
0N/A _initial_pause_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_initial_pause()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A#endif
0N/A inline void update_remark_pause_counter() {
0N/A _remark_pause_counter->set_value(
0N/A (jlong) (cms_size_policy()-> avg_remark_pause()->last_sample() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_avg_concurrent_time_counter() {
0N/A _avg_concurrent_time_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_concurrent_time()->last_sample() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_avg_concurrent_interval_counter() {
0N/A _avg_concurrent_interval_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_concurrent_interval()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_avg_concurrent_gc_cost_counter() {
0N/A _avg_concurrent_gc_cost_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_concurrent_gc_cost()->average() * 100.0));
0N/A }
0N/A
0N/A inline void update_avg_cms_free_counter() {
0N/A _avg_cms_free_counter->set_value(
0N/A (jlong) cms_size_policy()->avg_cms_free()->average());
0N/A }
0N/A
0N/A inline void update_avg_cms_free_at_sweep_counter() {
0N/A _avg_cms_free_at_sweep_counter->set_value(
0N/A (jlong) cms_size_policy()->avg_cms_free_at_sweep()->average());
0N/A }
0N/A
0N/A inline void update_avg_cms_promo_counter() {
0N/A _avg_cms_promo_counter->set_value(
0N/A (jlong) cms_size_policy()->avg_cms_promo()->average());
0N/A }
0N/A
0N/A inline void update_avg_old_live_counter() {
0N/A _avg_old_live_counter->set_value(
0N/A (jlong)(cms_size_policy()->avg_old_live()->average())
0N/A );
0N/A }
0N/A
0N/A inline void update_avg_msc_pause_counter() {
0N/A _avg_msc_pause_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_msc_pause()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_avg_msc_interval_counter() {
0N/A _avg_msc_interval_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_msc_interval()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_msc_gc_cost_counter() {
0N/A _msc_gc_cost_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_msc_gc_cost()->average() * 100.0));
0N/A }
0N/A
0N/A inline void update_avg_ms_pause_counter() {
0N/A _avg_ms_pause_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_ms_pause()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_avg_ms_interval_counter() {
0N/A _avg_ms_interval_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_ms_interval()->average() *
0N/A (double) MILLIUNITS));
0N/A }
0N/A
0N/A inline void update_ms_gc_cost_counter() {
0N/A _ms_gc_cost_counter->set_value(
0N/A (jlong) (cms_size_policy()->avg_ms_gc_cost()->average() * 100.0));
0N/A }
0N/A
0N/A inline void update_major_gc_cost_counter() {
0N/A _major_gc_cost_counter->set_value(
0N/A (jlong)(cms_size_policy()->cms_gc_cost() * 100.0)
0N/A );
0N/A }
0N/A inline void update_mutator_cost_counter() {
0N/A _mutator_cost_counter->set_value(
0N/A (jlong)(cms_size_policy()->mutator_cost() * 100.0)
0N/A );
0N/A }
0N/A
0N/A inline void update_avg_promoted_avg(CMSGCStats* gc_stats) {
0N/A _promoted_avg_counter->set_value(
0N/A (jlong)(gc_stats->avg_promoted()->average())
0N/A );
0N/A }
0N/A inline void update_avg_promoted_dev(CMSGCStats* gc_stats) {
0N/A _promoted_avg_dev_counter->set_value(
0N/A (jlong)(gc_stats->avg_promoted()->deviation())
0N/A );
0N/A }
0N/A inline void update_avg_promoted_padded_avg(CMSGCStats* gc_stats) {
0N/A _promoted_padded_avg_counter->set_value(
0N/A (jlong)(gc_stats->avg_promoted()->padded_average())
0N/A );
0N/A }
0N/A inline void update_remark_pause_old_slope_counter() {
0N/A _remark_pause_old_slope_counter->set_value(
0N/A (jlong)(cms_size_policy()->remark_pause_old_slope() * 1000)
0N/A );
0N/A }
0N/A inline void update_initial_pause_old_slope_counter() {
0N/A _initial_pause_old_slope_counter->set_value(
0N/A (jlong)(cms_size_policy()->initial_pause_old_slope() * 1000)
0N/A );
0N/A }
0N/A inline void update_remark_pause_young_slope_counter() {
0N/A _remark_pause_young_slope_counter->set_value(
0N/A (jlong)(cms_size_policy()->remark_pause_young_slope() * 1000)
0N/A );
0N/A }
0N/A inline void update_initial_pause_young_slope_counter() {
0N/A _initial_pause_young_slope_counter->set_value(
0N/A (jlong)(cms_size_policy()->initial_pause_young_slope() * 1000)
0N/A );
0N/A }
0N/A inline void update_change_young_gen_for_maj_pauses() {
0N/A _change_young_gen_for_maj_pauses_counter->set_value(
0N/A cms_size_policy()->change_young_gen_for_maj_pauses());
0N/A }
0N/A
0N/A public:
0N/A CMSGCAdaptivePolicyCounters(const char* name, int collectors, int generations,
0N/A AdaptiveSizePolicy* size_policy);
0N/A
0N/A // update counters
0N/A void update_counters();
0N/A void update_counters(CMSGCStats* gc_stats);
0N/A void update_counters_from_policy();
0N/A
0N/A inline void update_cms_capacity_counter(size_t size_in_bytes) {
0N/A _cms_capacity_counter->set_value(size_in_bytes);
0N/A }
0N/A
0N/A virtual GCPolicyCounters::Name kind() const {
0N/A return GCPolicyCounters::CMSGCAdaptivePolicyCountersKind;
0N/A }
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP