Wed, 11 Sep 2013 00:38:18 -0400
8024256: Minimal VM build is broken with PCH disabled
Reviewed-by: coleenp, twisti
jmasa@2821 | 1 | /* |
dholmes@5689 | 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
jmasa@2821 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jmasa@2821 | 4 | * |
jmasa@2821 | 5 | * This code is free software; you can redistribute it and/or modify it |
jmasa@2821 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jmasa@2821 | 7 | * published by the Free Software Foundation. |
jmasa@2821 | 8 | * |
jmasa@2821 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jmasa@2821 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jmasa@2821 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jmasa@2821 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jmasa@2821 | 13 | * accompanied this code). |
jmasa@2821 | 14 | * |
jmasa@2821 | 15 | * You should have received a copy of the GNU General Public License version |
jmasa@2821 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jmasa@2821 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jmasa@2821 | 18 | * |
jmasa@2821 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jmasa@2821 | 20 | * or visit www.oracle.com if you need additional information or have any |
jmasa@2821 | 21 | * questions. |
jmasa@2821 | 22 | * |
jmasa@2821 | 23 | */ |
jmasa@2821 | 24 | |
jmasa@2821 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP |
jmasa@2821 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP |
jmasa@2821 | 27 | |
jprovino@4542 | 28 | #include "utilities/macros.hpp" |
jmasa@2821 | 29 | #include "gc_implementation/shared/generationCounters.hpp" |
jmasa@2821 | 30 | #include "memory/generation.hpp" |
jmasa@2821 | 31 | #include "runtime/perfData.hpp" |
jmasa@2821 | 32 | |
jmasa@2821 | 33 | // A HSpaceCounter is a holder class for performance counters |
jmasa@2821 | 34 | // that track a collections (logical spaces) in a heap; |
jmasa@2821 | 35 | |
jmasa@2821 | 36 | class HeapSpaceUsedHelper; |
jmasa@2821 | 37 | class G1SpaceMonitoringSupport; |
jmasa@2821 | 38 | |
zgu@3900 | 39 | class HSpaceCounters: public CHeapObj<mtGC> { |
jmasa@2821 | 40 | friend class VMStructs; |
jmasa@2821 | 41 | |
jmasa@2821 | 42 | private: |
jmasa@2821 | 43 | PerfVariable* _capacity; |
jmasa@2821 | 44 | PerfVariable* _used; |
jmasa@2821 | 45 | |
jmasa@2821 | 46 | // Constant PerfData types don't need to retain a reference. |
jmasa@2821 | 47 | // However, it's a good idea to document them here. |
jmasa@2821 | 48 | |
jmasa@2821 | 49 | char* _name_space; |
jmasa@2821 | 50 | |
jmasa@2821 | 51 | public: |
jmasa@2821 | 52 | |
jmasa@2821 | 53 | HSpaceCounters(const char* name, int ordinal, size_t max_size, |
jmasa@2821 | 54 | size_t initial_capacity, GenerationCounters* gc); |
jmasa@2821 | 55 | |
jmasa@2821 | 56 | ~HSpaceCounters() { |
zgu@3900 | 57 | if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC); |
jmasa@2821 | 58 | } |
jmasa@2821 | 59 | |
jmasa@2821 | 60 | inline void update_capacity(size_t v) { |
jmasa@2821 | 61 | _capacity->set_value(v); |
jmasa@2821 | 62 | } |
jmasa@2821 | 63 | |
jmasa@2821 | 64 | inline void update_used(size_t v) { |
jmasa@2821 | 65 | _used->set_value(v); |
jmasa@2821 | 66 | } |
jmasa@2821 | 67 | |
jmasa@2821 | 68 | debug_only( |
jmasa@2821 | 69 | // for security reasons, we do not allow arbitrary reads from |
jmasa@2821 | 70 | // the counters as they may live in shared memory. |
jmasa@2821 | 71 | jlong used() { |
jmasa@2821 | 72 | return _used->get_value(); |
jmasa@2821 | 73 | } |
jmasa@2821 | 74 | jlong capacity() { |
jmasa@2821 | 75 | return _used->get_value(); |
jmasa@2821 | 76 | } |
jmasa@2821 | 77 | ) |
jmasa@2821 | 78 | |
jmasa@2821 | 79 | inline void update_all(size_t capacity, size_t used) { |
jmasa@2821 | 80 | update_capacity(capacity); |
jmasa@2821 | 81 | update_used(used); |
jmasa@2821 | 82 | } |
jmasa@2821 | 83 | |
jmasa@2821 | 84 | const char* name_space() const { return _name_space; } |
jmasa@2821 | 85 | }; |
jmasa@2821 | 86 | #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP |