Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp
38921 views
/*1* Copyright (c) 2011, 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_HSPACECOUNTERS_HPP25#define SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP2627#include "utilities/macros.hpp"28#include "gc_implementation/shared/generationCounters.hpp"29#include "memory/generation.hpp"30#include "runtime/perfData.hpp"3132// A HSpaceCounter is a holder class for performance counters33// that track a collections (logical spaces) in a heap;3435class HeapSpaceUsedHelper;36class G1SpaceMonitoringSupport;3738class HSpaceCounters: public CHeapObj<mtGC> {39friend class VMStructs;4041private:42PerfVariable* _capacity;43PerfVariable* _used;4445// Constant PerfData types don't need to retain a reference.46// However, it's a good idea to document them here.4748char* _name_space;4950public:5152HSpaceCounters(const char* name, int ordinal, size_t max_size,53size_t initial_capacity, GenerationCounters* gc);5455~HSpaceCounters() {56if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);57}5859inline void update_capacity(size_t v) {60_capacity->set_value(v);61}6263inline void update_used(size_t v) {64_used->set_value(v);65}6667debug_only(68// for security reasons, we do not allow arbitrary reads from69// the counters as they may live in shared memory.70jlong used() {71return _used->get_value();72}73jlong capacity() {74return _used->get_value();75}76)7778inline void update_all(size_t capacity, size_t used) {79update_capacity(capacity);80update_used(used);81}8283const char* name_space() const { return _name_space; }84};85#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP868788