Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp
38920 views
/*1* Copyright (c) 2003, 2013, 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_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP25#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP2627#include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"28#include "gc_implementation/shared/gcAdaptivePolicyCounters.hpp"29#include "gc_implementation/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* _gc_overhead_limit_exceeded_counter;54PerfVariable* _live_at_last_full_gc_counter;55PerfVariable* _old_capacity;56PerfVariable* _boundary_moved;5758PerfVariable* _change_old_gen_for_min_pauses;59PerfVariable* _change_young_gen_for_maj_pauses_counter;6061PerfVariable* _major_pause_old_slope;62PerfVariable* _minor_pause_old_slope;63PerfVariable* _major_pause_young_slope;6465PerfVariable* _scavenge_skipped;66PerfVariable* _full_follows_scavenge;6768// Use this time stamp if the gc time stamp is not available.69TimeStamp _counter_time_stamp;7071protected:72PSAdaptiveSizePolicy* ps_size_policy() {73return (PSAdaptiveSizePolicy*)_size_policy;74}7576public:77PSGCAdaptivePolicyCounters(const char* name, int collectors, int generations,78PSAdaptiveSizePolicy* size_policy);79inline void update_old_capacity(size_t size_in_bytes) {80_old_capacity->set_value(size_in_bytes);81}82inline void update_old_eden_size(size_t old_size) {83_old_eden_size->set_value(old_size);84}85inline void update_old_promo_size(size_t old_size) {86_old_promo_size->set_value(old_size);87}88inline void update_boundary_moved(int size_in_bytes) {89_boundary_moved->set_value(size_in_bytes);90}91inline void update_avg_promoted_avg() {92_avg_promoted_avg_counter->set_value(93(jlong)(ps_size_policy()->avg_promoted()->average())94);95}96inline void update_avg_promoted_dev() {97_avg_promoted_dev_counter->set_value(98(jlong)(ps_size_policy()->avg_promoted()->deviation())99);100}101inline void update_avg_promoted_padded_avg() {102_avg_promoted_padded_avg_counter->set_value(103(jlong)(ps_size_policy()->avg_promoted()->padded_average())104);105}106107inline void update_avg_pretenured_padded_avg() {108_avg_pretenured_padded_avg->set_value(109(jlong)(ps_size_policy()->_avg_pretenured->padded_average())110);111}112inline void update_change_young_gen_for_maj_pauses() {113_change_young_gen_for_maj_pauses_counter->set_value(114ps_size_policy()->change_young_gen_for_maj_pauses());115}116inline void update_change_old_gen_for_min_pauses() {117_change_old_gen_for_min_pauses->set_value(118ps_size_policy()->change_old_gen_for_min_pauses());119}120121// compute_generations_free_space() statistics122123inline void update_avg_major_pause() {124_avg_major_pause->set_value(125(jlong)(ps_size_policy()->_avg_major_pause->average() * 1000.0)126);127}128inline void update_avg_major_interval() {129_avg_major_interval->set_value(130(jlong)(ps_size_policy()->_avg_major_interval->average() * 1000.0)131);132}133134inline void update_major_gc_cost_counter() {135_major_gc_cost_counter->set_value(136(jlong)(ps_size_policy()->major_gc_cost() * 100.0)137);138}139inline void update_mutator_cost_counter() {140_mutator_cost_counter->set_value(141(jlong)(ps_size_policy()->mutator_cost() * 100.0)142);143}144145inline void update_live_space() {146_live_space->set_value(ps_size_policy()->live_space());147}148inline void update_free_space() {149_free_space->set_value(ps_size_policy()->free_space());150}151152inline void update_avg_base_footprint() {153_avg_base_footprint->set_value(154(jlong)(ps_size_policy()->avg_base_footprint()->average())155);156}157inline void update_avg_old_live() {158_avg_old_live_counter->set_value(159(jlong)(ps_size_policy()->avg_old_live()->average())160);161}162// Scale up all the slopes163inline void update_major_pause_old_slope() {164_major_pause_old_slope->set_value(165(jlong)(ps_size_policy()->major_pause_old_slope() * 1000)166);167}168inline void update_minor_pause_old_slope() {169_minor_pause_old_slope->set_value(170(jlong)(ps_size_policy()->minor_pause_old_slope() * 1000)171);172}173inline void update_major_pause_young_slope() {174_major_pause_young_slope->set_value(175(jlong)(ps_size_policy()->major_pause_young_slope() * 1000)176);177}178inline void update_gc_overhead_limit_exceeded_counter() {179_gc_overhead_limit_exceeded_counter->set_value(180(jlong) ps_size_policy()->gc_overhead_limit_exceeded());181}182inline void update_live_at_last_full_gc_counter() {183_live_at_last_full_gc_counter->set_value(184(jlong)(ps_size_policy()->live_at_last_full_gc()));185}186187inline void update_scavenge_skipped(int cause) {188_scavenge_skipped->set_value(cause);189}190191inline void update_full_follows_scavenge(int event) {192_full_follows_scavenge->set_value(event);193}194195// Update all the counters that can be updated from the size policy.196// This should be called after all policy changes have been made197// and reflected internall in the size policy.198void update_counters_from_policy();199200// Update counters that can be updated from fields internal to the201// counter or from globals. This is distinguished from counters202// that are updated via input parameters.203void update_counters();204205virtual GCPolicyCounters::Name kind() const {206return GCPolicyCounters::PSGCAdaptivePolicyCountersKind;207}208};209210#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP211212213