annotate src/share/vm/gc_implementation/shared/hSpaceCounters.hpp @ 14909:4ca6dc0799b6

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