Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp
38920 views
/*1* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP25#define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP2627#include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"28#include "gc_implementation/shared/gcAdaptivePolicyCounters.hpp"29#include "gc_implementation/shared/gcStats.hpp"30#include "runtime/perfData.hpp"3132// CMSGCAdaptivePolicyCounters is a holder class for performance counters33// that track the data and decisions for the ergonomics policy for the34// concurrent mark sweep collector3536class CMSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {37friend class VMStructs;3839private:4041// Capacity of tenured generation recorded at the end of42// any collection.43PerfVariable* _cms_capacity_counter; // Make this common with PS _old_capacity4445// Average stop-the-world pause time for both initial and46// remark pauses sampled at the end of the checkpointRootsFinalWork.47PerfVariable* _avg_cms_STW_time_counter;48// Average stop-the-world (STW) GC cost for the STW pause time49// _avg_cms_STW_time_counter.50PerfVariable* _avg_cms_STW_gc_cost_counter;5152#ifdef NOT_PRODUCT53// These are useful to see how the most recent values of these54// counters compare to their respective averages but55// do not control behavior.56PerfVariable* _initial_pause_counter;57PerfVariable* _remark_pause_counter;58#endif5960// Average of the initial marking pause for a concurrent collection.61PerfVariable* _avg_initial_pause_counter;62// Average of the remark pause for a concurrent collection.63PerfVariable* _avg_remark_pause_counter;6465// Average for the sum of all the concurrent times per collection.66PerfVariable* _avg_concurrent_time_counter;67// Average for the time between the most recent end of a68// concurrent collection and the beginning of the next69// concurrent collection.70PerfVariable* _avg_concurrent_interval_counter;71// Average of the concurrent GC costs based on _avg_concurrent_time_counter72// and _avg_concurrent_interval_counter.73PerfVariable* _avg_concurrent_gc_cost_counter;7475// Average of the free space in the tenured generation at the76// end of the sweep of the tenured generation.77PerfVariable* _avg_cms_free_counter;78// Average of the free space in the tenured generation at the79// start of the sweep of the tenured generation.80PerfVariable* _avg_cms_free_at_sweep_counter;81// Average of the free space in the tenured generation at the82// after any resizing of the tenured generation at the end83// of a collection of the tenured generation.84PerfVariable* _avg_cms_promo_counter;8586// Average of the mark-sweep-compact (MSC) pause time for a collection87// of the tenured generation.88PerfVariable* _avg_msc_pause_counter;89// Average for the time between the most recent end of a90// MSC collection and the beginning of the next91// MSC collection.92PerfVariable* _avg_msc_interval_counter;93// Average for the GC cost of a MSC collection based on94// _avg_msc_pause_counter and _avg_msc_interval_counter.95PerfVariable* _msc_gc_cost_counter;9697// Average of the mark-sweep (MS) pause time for a collection98// of the tenured generation.99PerfVariable* _avg_ms_pause_counter;100// Average for the time between the most recent end of a101// MS collection and the beginning of the next102// MS collection.103PerfVariable* _avg_ms_interval_counter;104// Average for the GC cost of a MS collection based on105// _avg_ms_pause_counter and _avg_ms_interval_counter.106PerfVariable* _ms_gc_cost_counter;107108// Average of the bytes promoted per minor collection.109PerfVariable* _promoted_avg_counter;110// Average of the deviation of the promoted average111PerfVariable* _promoted_avg_dev_counter;112// Padded average of the bytes promoted per minor colleciton113PerfVariable* _promoted_padded_avg_counter;114115// See description of the _change_young_gen_for_maj_pauses116// variable recently in cmsAdaptiveSizePolicy.hpp.117PerfVariable* _change_young_gen_for_maj_pauses_counter;118119// See descriptions of _remark_pause_old_slope, _initial_pause_old_slope,120// etc. variables recently in cmsAdaptiveSizePolicy.hpp.121PerfVariable* _remark_pause_old_slope_counter;122PerfVariable* _initial_pause_old_slope_counter;123PerfVariable* _remark_pause_young_slope_counter;124PerfVariable* _initial_pause_young_slope_counter;125126CMSAdaptiveSizePolicy* cms_size_policy() {127assert(_size_policy->kind() ==128AdaptiveSizePolicy::_gc_cms_adaptive_size_policy,129"Wrong size policy");130return (CMSAdaptiveSizePolicy*)_size_policy;131}132133inline void update_avg_cms_STW_time_counter() {134_avg_cms_STW_time_counter->set_value(135(jlong) (cms_size_policy()->avg_cms_STW_time()->average() *136(double) MILLIUNITS));137}138139inline void update_avg_cms_STW_gc_cost_counter() {140_avg_cms_STW_gc_cost_counter->set_value(141(jlong) (cms_size_policy()->avg_cms_STW_gc_cost()->average() * 100.0));142}143144inline void update_avg_initial_pause_counter() {145_avg_initial_pause_counter->set_value(146(jlong) (cms_size_policy()->avg_initial_pause()->average() *147(double) MILLIUNITS));148}149#ifdef NOT_PRODUCT150inline void update_avg_remark_pause_counter() {151_avg_remark_pause_counter->set_value(152(jlong) (cms_size_policy()-> avg_remark_pause()->average() *153(double) MILLIUNITS));154}155156inline void update_initial_pause_counter() {157_initial_pause_counter->set_value(158(jlong) (cms_size_policy()->avg_initial_pause()->average() *159(double) MILLIUNITS));160}161#endif162inline void update_remark_pause_counter() {163_remark_pause_counter->set_value(164(jlong) (cms_size_policy()-> avg_remark_pause()->last_sample() *165(double) MILLIUNITS));166}167168inline void update_avg_concurrent_time_counter() {169_avg_concurrent_time_counter->set_value(170(jlong) (cms_size_policy()->avg_concurrent_time()->last_sample() *171(double) MILLIUNITS));172}173174inline void update_avg_concurrent_interval_counter() {175_avg_concurrent_interval_counter->set_value(176(jlong) (cms_size_policy()->avg_concurrent_interval()->average() *177(double) MILLIUNITS));178}179180inline void update_avg_concurrent_gc_cost_counter() {181_avg_concurrent_gc_cost_counter->set_value(182(jlong) (cms_size_policy()->avg_concurrent_gc_cost()->average() * 100.0));183}184185inline void update_avg_cms_free_counter() {186_avg_cms_free_counter->set_value(187(jlong) cms_size_policy()->avg_cms_free()->average());188}189190inline void update_avg_cms_free_at_sweep_counter() {191_avg_cms_free_at_sweep_counter->set_value(192(jlong) cms_size_policy()->avg_cms_free_at_sweep()->average());193}194195inline void update_avg_cms_promo_counter() {196_avg_cms_promo_counter->set_value(197(jlong) cms_size_policy()->avg_cms_promo()->average());198}199200inline void update_avg_old_live_counter() {201_avg_old_live_counter->set_value(202(jlong)(cms_size_policy()->avg_old_live()->average())203);204}205206inline void update_avg_msc_pause_counter() {207_avg_msc_pause_counter->set_value(208(jlong) (cms_size_policy()->avg_msc_pause()->average() *209(double) MILLIUNITS));210}211212inline void update_avg_msc_interval_counter() {213_avg_msc_interval_counter->set_value(214(jlong) (cms_size_policy()->avg_msc_interval()->average() *215(double) MILLIUNITS));216}217218inline void update_msc_gc_cost_counter() {219_msc_gc_cost_counter->set_value(220(jlong) (cms_size_policy()->avg_msc_gc_cost()->average() * 100.0));221}222223inline void update_avg_ms_pause_counter() {224_avg_ms_pause_counter->set_value(225(jlong) (cms_size_policy()->avg_ms_pause()->average() *226(double) MILLIUNITS));227}228229inline void update_avg_ms_interval_counter() {230_avg_ms_interval_counter->set_value(231(jlong) (cms_size_policy()->avg_ms_interval()->average() *232(double) MILLIUNITS));233}234235inline void update_ms_gc_cost_counter() {236_ms_gc_cost_counter->set_value(237(jlong) (cms_size_policy()->avg_ms_gc_cost()->average() * 100.0));238}239240inline void update_major_gc_cost_counter() {241_major_gc_cost_counter->set_value(242(jlong)(cms_size_policy()->cms_gc_cost() * 100.0)243);244}245inline void update_mutator_cost_counter() {246_mutator_cost_counter->set_value(247(jlong)(cms_size_policy()->mutator_cost() * 100.0)248);249}250251inline void update_avg_promoted_avg(CMSGCStats* gc_stats) {252_promoted_avg_counter->set_value(253(jlong)(gc_stats->avg_promoted()->average())254);255}256inline void update_avg_promoted_dev(CMSGCStats* gc_stats) {257_promoted_avg_dev_counter->set_value(258(jlong)(gc_stats->avg_promoted()->deviation())259);260}261inline void update_avg_promoted_padded_avg(CMSGCStats* gc_stats) {262_promoted_padded_avg_counter->set_value(263(jlong)(gc_stats->avg_promoted()->padded_average())264);265}266inline void update_remark_pause_old_slope_counter() {267_remark_pause_old_slope_counter->set_value(268(jlong)(cms_size_policy()->remark_pause_old_slope() * 1000)269);270}271inline void update_initial_pause_old_slope_counter() {272_initial_pause_old_slope_counter->set_value(273(jlong)(cms_size_policy()->initial_pause_old_slope() * 1000)274);275}276inline void update_remark_pause_young_slope_counter() {277_remark_pause_young_slope_counter->set_value(278(jlong)(cms_size_policy()->remark_pause_young_slope() * 1000)279);280}281inline void update_initial_pause_young_slope_counter() {282_initial_pause_young_slope_counter->set_value(283(jlong)(cms_size_policy()->initial_pause_young_slope() * 1000)284);285}286inline void update_change_young_gen_for_maj_pauses() {287_change_young_gen_for_maj_pauses_counter->set_value(288cms_size_policy()->change_young_gen_for_maj_pauses());289}290291public:292CMSGCAdaptivePolicyCounters(const char* name, int collectors, int generations,293AdaptiveSizePolicy* size_policy);294295// update counters296void update_counters();297void update_counters(CMSGCStats* gc_stats);298void update_counters_from_policy();299300inline void update_cms_capacity_counter(size_t size_in_bytes) {301_cms_capacity_counter->set_value(size_in_bytes);302}303304virtual GCPolicyCounters::Name kind() const {305return GCPolicyCounters::CMSGCAdaptivePolicyCountersKind;306}307};308309#endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP310311312