Path: blob/master/src/hotspot/share/gc/parallel/psGCAdaptivePolicyCounters.hpp
41152 views
/*1* Copyright (c) 2003, 2019, 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_GC_PARALLEL_PSGCADAPTIVEPOLICYCOUNTERS_HPP25#define SHARE_GC_PARALLEL_PSGCADAPTIVEPOLICYCOUNTERS_HPP2627#include "gc/parallel/gcAdaptivePolicyCounters.hpp"28#include "gc/parallel/psAdaptiveSizePolicy.hpp"29#include "gc/shared/gcPolicyCounters.hpp"3031// PSGCAdaptivePolicyCounters is a holder class for performance counters32// that track the data and decisions for the ergonomics policy for the33// parallel scavenge collector.3435class PSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {36friend class VMStructs;3738private:39// survivor space vs. tenuring threshold40PerfVariable* _old_promo_size;41PerfVariable* _old_eden_size;42PerfVariable* _avg_promoted_avg_counter;43PerfVariable* _avg_promoted_dev_counter;44PerfVariable* _avg_promoted_padded_avg_counter;45PerfVariable* _avg_pretenured_padded_avg;4647// young gen vs. old gen sizing48PerfVariable* _avg_major_pause;49PerfVariable* _avg_major_interval;50PerfVariable* _live_space;51PerfVariable* _free_space;52PerfVariable* _avg_base_footprint;53PerfVariable* _live_at_last_full_gc_counter;54PerfVariable* _old_capacity;5556PerfVariable* _change_old_gen_for_min_pauses;57PerfVariable* _change_young_gen_for_maj_pauses_counter;5859PerfVariable* _major_pause_old_slope;60PerfVariable* _minor_pause_old_slope;61PerfVariable* _major_pause_young_slope;6263PerfVariable* _scavenge_skipped;64PerfVariable* _full_follows_scavenge;6566// Use this time stamp if the gc time stamp is not available.67TimeStamp _counter_time_stamp;6869protected:70PSAdaptiveSizePolicy* ps_size_policy() {71return (PSAdaptiveSizePolicy*)_size_policy;72}7374public:75PSGCAdaptivePolicyCounters(const char* name, int collectors, int generations,76PSAdaptiveSizePolicy* size_policy);77inline void update_old_capacity(size_t size_in_bytes) {78_old_capacity->set_value(size_in_bytes);79}80inline void update_old_eden_size(size_t old_size) {81_old_eden_size->set_value(old_size);82}83inline void update_old_promo_size(size_t old_size) {84_old_promo_size->set_value(old_size);85}86inline void update_avg_promoted_avg() {87_avg_promoted_avg_counter->set_value(88(jlong)(ps_size_policy()->avg_promoted()->average())89);90}91inline void update_avg_promoted_dev() {92_avg_promoted_dev_counter->set_value(93(jlong)(ps_size_policy()->avg_promoted()->deviation())94);95}96inline void update_avg_promoted_padded_avg() {97_avg_promoted_padded_avg_counter->set_value(98(jlong)(ps_size_policy()->avg_promoted()->padded_average())99);100}101102inline void update_avg_pretenured_padded_avg() {103_avg_pretenured_padded_avg->set_value(104(jlong)(ps_size_policy()->_avg_pretenured->padded_average())105);106}107inline void update_change_young_gen_for_maj_pauses() {108_change_young_gen_for_maj_pauses_counter->set_value(109ps_size_policy()->change_young_gen_for_maj_pauses());110}111inline void update_change_old_gen_for_min_pauses() {112_change_old_gen_for_min_pauses->set_value(113ps_size_policy()->change_old_gen_for_min_pauses());114}115116// compute_generations_free_space() statistics117118inline void update_avg_major_pause() {119_avg_major_pause->set_value(120(jlong)(ps_size_policy()->_avg_major_pause->average() * 1000.0)121);122}123inline void update_avg_major_interval() {124_avg_major_interval->set_value(125(jlong)(ps_size_policy()->_avg_major_interval->average() * 1000.0)126);127}128129inline void update_major_gc_cost_counter() {130_major_gc_cost_counter->set_value(131(jlong)(ps_size_policy()->major_gc_cost() * 100.0)132);133}134inline void update_mutator_cost_counter() {135_mutator_cost_counter->set_value(136(jlong)(ps_size_policy()->mutator_cost() * 100.0)137);138}139140inline void update_live_space() {141_live_space->set_value(ps_size_policy()->live_space());142}143inline void update_free_space() {144_free_space->set_value(ps_size_policy()->free_space());145}146147inline void update_avg_base_footprint() {148_avg_base_footprint->set_value(149(jlong)(ps_size_policy()->avg_base_footprint()->average())150);151}152inline void update_avg_old_live() {153_avg_old_live_counter->set_value(154(jlong)(ps_size_policy()->avg_old_live()->average())155);156}157// Scale up all the slopes158inline void update_major_pause_old_slope() {159_major_pause_old_slope->set_value(160(jlong)(ps_size_policy()->major_pause_old_slope() * 1000)161);162}163inline void update_minor_pause_old_slope() {164_minor_pause_old_slope->set_value(165(jlong)(ps_size_policy()->minor_pause_old_slope() * 1000)166);167}168inline void update_major_pause_young_slope() {169_major_pause_young_slope->set_value(170(jlong)(ps_size_policy()->major_pause_young_slope() * 1000)171);172}173inline void update_gc_overhead_limit_exceeded_counter() {174gc_overhead_limit_exceeded_counter()->set_value(175(jlong) ps_size_policy()->gc_overhead_limit_exceeded());176}177inline void update_live_at_last_full_gc_counter() {178_live_at_last_full_gc_counter->set_value(179(jlong)(ps_size_policy()->live_at_last_full_gc()));180}181182inline void update_scavenge_skipped(int cause) {183_scavenge_skipped->set_value(cause);184}185186inline void update_full_follows_scavenge(int event) {187_full_follows_scavenge->set_value(event);188}189190// Update all the counters that can be updated from the size policy.191// This should be called after all policy changes have been made192// and reflected internally in the size policy.193void update_counters_from_policy();194195// Update counters that can be updated from fields internal to the196// counter or from globals. This is distinguished from counters197// that are updated via input parameters.198void update_counters();199200virtual GCPolicyCounters::Name kind() const {201return GCPolicyCounters::PSGCAdaptivePolicyCountersKind;202}203};204205#endif // SHARE_GC_PARALLEL_PSGCADAPTIVEPOLICYCOUNTERS_HPP206207208