annotate src/share/vm/gc_implementation/shared/hSpaceCounters.hpp @ 6842:b9a9ed0f8eeb

7197424: update copyright year to match last edit in jdk8 hotspot repository Summary: Update copyright year to 2012 for relevant files Reviewed-by: dholmes, coleenp
author mikael
date Tue, 09 Oct 2012 10:09:34 -0700
parents d2a62e0f25eb
children db9981fd3124
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 /*
6842
b9a9ed0f8eeb 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 6197
diff changeset
2 * Copyright (c) 2011, 2012, 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
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
28 #ifndef SERIALGC
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 #endif
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
33
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
34 // A HSpaceCounter is a holder class for performance counters
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
35 // that track a collections (logical spaces) in a heap;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
36
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
37 class HeapSpaceUsedHelper;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
38 class G1SpaceMonitoringSupport;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
39
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 3289
diff changeset
40 class HSpaceCounters: public CHeapObj<mtGC> {
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
41 friend class VMStructs;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
42
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
43 private:
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
44 PerfVariable* _capacity;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
45 PerfVariable* _used;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
46
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
47 // Constant PerfData types don't need to retain a reference.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
48 // However, it's a good idea to document them here.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
49
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
50 char* _name_space;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
51
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
52 public:
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
53
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
54 HSpaceCounters(const char* name, int ordinal, size_t max_size,
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
55 size_t initial_capacity, GenerationCounters* gc);
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
56
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
57 ~HSpaceCounters() {
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 3289
diff changeset
58 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
59 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
60
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
61 inline void update_capacity(size_t v) {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
62 _capacity->set_value(v);
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
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
65 inline void update_used(size_t v) {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
66 _used->set_value(v);
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
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
69 debug_only(
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
70 // for security reasons, we do not allow arbitrary reads from
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
71 // the counters as they may live in shared memory.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
72 jlong used() {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
73 return _used->get_value();
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
74 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
75 jlong capacity() {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
76 return _used->get_value();
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
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
80 inline void update_all(size_t capacity, size_t used) {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
81 update_capacity(capacity);
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
82 update_used(used);
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
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
85 const char* name_space() const { return _name_space; }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
86 };
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
87 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP