Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shared/gcAdaptivePolicyCounters.hpp
38921 views
/*1* Copyright (c) 2004, 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_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP25#define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP2627#include "utilities/macros.hpp"28#if INCLUDE_ALL_GCS29#include "gc_implementation/shared/adaptiveSizePolicy.hpp"30#include "gc_implementation/shared/gcPolicyCounters.hpp"31#endif // INCLUDE_ALL_GCS3233// This class keeps statistical information and computes the34// size of the heap.3536class GCAdaptivePolicyCounters : public GCPolicyCounters {37protected:38PerfVariable* _eden_size_counter;39PerfVariable* _promo_size_counter;4041PerfVariable* _young_capacity_counter;4243PerfVariable* _minor_gc_cost_counter;44PerfVariable* _major_gc_cost_counter;45PerfVariable* _mutator_cost_counter;4647PerfVariable* _avg_young_live_counter;48PerfVariable* _avg_old_live_counter;4950PerfVariable* _avg_minor_pause_counter;51PerfVariable* _avg_minor_interval_counter;5253#ifdef NOT_PRODUCT54PerfVariable* _minor_pause_counter;55#endif5657PerfVariable* _change_young_gen_for_min_pauses_counter;58PerfVariable* _change_young_gen_for_throughput_counter;59PerfVariable* _change_old_gen_for_maj_pauses_counter;60PerfVariable* _change_old_gen_for_throughput_counter;61PerfVariable* _decrease_for_footprint_counter;6263PerfVariable* _minor_pause_young_slope_counter;64PerfVariable* _major_pause_old_slope_counter;6566PerfVariable* _decide_at_full_gc_counter;6768PerfVariable* _survived_counter;69PerfVariable* _promoted_counter;7071PerfVariable* _avg_survived_avg_counter;72PerfVariable* _avg_survived_dev_counter;73PerfVariable* _avg_survived_padded_avg_counter;7475PerfVariable* _survivor_overflowed_counter;76PerfVariable* _increment_tenuring_threshold_for_gc_cost_counter;77PerfVariable* _decrement_tenuring_threshold_for_gc_cost_counter;78PerfVariable* _decrement_tenuring_threshold_for_survivor_limit_counter;7980PerfVariable* _minor_collection_slope_counter;81PerfVariable* _major_collection_slope_counter;8283AdaptiveSizePolicy* _size_policy;8485inline void update_eden_size() {86size_t eden_size_in_bytes = size_policy()->calculated_eden_size_in_bytes();87_eden_size_counter->set_value(eden_size_in_bytes);88}8990inline void update_promo_size() {91_promo_size_counter->set_value(92size_policy()->calculated_promo_size_in_bytes());93}9495inline void update_avg_minor_pause_counter() {96_avg_minor_pause_counter->set_value((jlong)97(size_policy()->avg_minor_pause()->average() * 1000.0));98}99inline void update_avg_minor_interval_counter() {100_avg_minor_interval_counter->set_value((jlong)101(size_policy()->avg_minor_interval()->average() * 1000.0));102}103104#ifdef NOT_PRODUCT105inline void update_minor_pause_counter() {106_minor_pause_counter->set_value((jlong)107(size_policy()->avg_minor_pause()->last_sample() * 1000.0));108}109#endif110inline void update_minor_gc_cost_counter() {111_minor_gc_cost_counter->set_value((jlong)112(size_policy()->minor_gc_cost() * 100.0));113}114115inline void update_avg_young_live_counter() {116_avg_young_live_counter->set_value(117(jlong)(size_policy()->avg_young_live()->average())118);119}120121inline void update_avg_survived_avg_counters() {122_avg_survived_avg_counter->set_value(123(jlong)(size_policy()->_avg_survived->average())124);125}126inline void update_avg_survived_dev_counters() {127_avg_survived_dev_counter->set_value(128(jlong)(size_policy()->_avg_survived->deviation())129);130}131inline void update_avg_survived_padded_avg_counters() {132_avg_survived_padded_avg_counter->set_value(133(jlong)(size_policy()->_avg_survived->padded_average())134);135}136137inline void update_change_old_gen_for_throughput() {138_change_old_gen_for_throughput_counter->set_value(139size_policy()->change_old_gen_for_throughput());140}141inline void update_change_young_gen_for_throughput() {142_change_young_gen_for_throughput_counter->set_value(143size_policy()->change_young_gen_for_throughput());144}145inline void update_decrease_for_footprint() {146_decrease_for_footprint_counter->set_value(147size_policy()->decrease_for_footprint());148}149150inline void update_decide_at_full_gc_counter() {151_decide_at_full_gc_counter->set_value(152size_policy()->decide_at_full_gc());153}154155inline void update_minor_pause_young_slope_counter() {156_minor_pause_young_slope_counter->set_value(157(jlong)(size_policy()->minor_pause_young_slope() * 1000)158);159}160161virtual void update_counters_from_policy();162163protected:164virtual AdaptiveSizePolicy* size_policy() { return _size_policy; }165166public:167GCAdaptivePolicyCounters(const char* name,168int collectors,169int generations,170AdaptiveSizePolicy* size_policy);171172inline void update_survived(size_t survived) {173_survived_counter->set_value(survived);174}175inline void update_promoted(size_t promoted) {176_promoted_counter->set_value(promoted);177}178inline void update_young_capacity(size_t size_in_bytes) {179_young_capacity_counter->set_value(size_in_bytes);180}181182virtual void update_counters();183184inline void update_survivor_size_counters() {185desired_survivor_size()->set_value(186size_policy()->calculated_survivor_size_in_bytes());187}188inline void update_survivor_overflowed(bool survivor_overflowed) {189_survivor_overflowed_counter->set_value(survivor_overflowed);190}191inline void update_tenuring_threshold(uint threshold) {192tenuring_threshold()->set_value(threshold);193}194inline void update_increment_tenuring_threshold_for_gc_cost() {195_increment_tenuring_threshold_for_gc_cost_counter->set_value(196size_policy()->increment_tenuring_threshold_for_gc_cost());197}198inline void update_decrement_tenuring_threshold_for_gc_cost() {199_decrement_tenuring_threshold_for_gc_cost_counter->set_value(200size_policy()->decrement_tenuring_threshold_for_gc_cost());201}202inline void update_decrement_tenuring_threshold_for_survivor_limit() {203_decrement_tenuring_threshold_for_survivor_limit_counter->set_value(204size_policy()->decrement_tenuring_threshold_for_survivor_limit());205}206inline void update_change_young_gen_for_min_pauses() {207_change_young_gen_for_min_pauses_counter->set_value(208size_policy()->change_young_gen_for_min_pauses());209}210inline void update_change_old_gen_for_maj_pauses() {211_change_old_gen_for_maj_pauses_counter->set_value(212size_policy()->change_old_gen_for_maj_pauses());213}214215inline void update_minor_collection_slope_counter() {216_minor_collection_slope_counter->set_value(217(jlong)(size_policy()->minor_collection_slope() * 1000)218);219}220221inline void update_major_collection_slope_counter() {222_major_collection_slope_counter->set_value(223(jlong)(size_policy()->major_collection_slope() * 1000)224);225}226227void set_size_policy(AdaptiveSizePolicy* v) { _size_policy = v; }228229virtual GCPolicyCounters::Name kind() const {230return GCPolicyCounters::GCAdaptivePolicyCountersKind;231}232};233234#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP235236237