Mercurial > hg > truffle
annotate src/share/vm/memory/metaspaceCounters.cpp @ 18136:52b8826ef035
Backout wrong change in 2a69cbe850a8
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 21 Oct 2014 10:20:33 +0200 |
parents | 52b4284cb496 |
children |
rev | line source |
---|---|
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 /* |
14223
de6a9e811145
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
12248
diff
changeset
|
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
4 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
8 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
13 * accompanied this code). |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
14 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
18 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
21 * questions. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
22 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
23 */ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
24 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
26 #include "memory/metaspaceCounters.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
27 #include "memory/resourceArea.hpp" |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
28 #include "runtime/globals.hpp" |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
29 #include "runtime/perfData.hpp" |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
30 #include "utilities/exceptions.hpp" |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
31 |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
32 class MetaspacePerfCounters: public CHeapObj<mtInternal> { |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
33 friend class VMStructs; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
34 PerfVariable* _capacity; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
35 PerfVariable* _used; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
36 PerfVariable* _max_capacity; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
37 |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
38 PerfVariable* create_variable(const char *ns, const char *name, size_t value, TRAPS) { |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
39 const char *path = PerfDataManager::counter_name(ns, name); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
40 return PerfDataManager::create_variable(SUN_GC, path, PerfData::U_Bytes, value, THREAD); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
41 } |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
42 |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
43 void create_constant(const char *ns, const char *name, size_t value, TRAPS) { |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
44 const char *path = PerfDataManager::counter_name(ns, name); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
45 PerfDataManager::create_constant(SUN_GC, path, PerfData::U_Bytes, value, THREAD); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
46 } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
47 |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
48 public: |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
49 MetaspacePerfCounters(const char* ns, size_t min_capacity, size_t curr_capacity, size_t max_capacity, size_t used) { |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
50 EXCEPTION_MARK; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
51 ResourceMark rm; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
52 |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
53 create_constant(ns, "minCapacity", min_capacity, THREAD); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
54 _capacity = create_variable(ns, "capacity", curr_capacity, THREAD); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
55 _max_capacity = create_variable(ns, "maxCapacity", max_capacity, THREAD); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
56 _used = create_variable(ns, "used", used, THREAD); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
57 } |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
58 |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
59 void update(size_t capacity, size_t max_capacity, size_t used) { |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
60 _capacity->set_value(capacity); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
61 _max_capacity->set_value(max_capacity); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
62 _used->set_value(used); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
63 } |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
64 }; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
65 |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
66 MetaspacePerfCounters* MetaspaceCounters::_perf_counters = NULL; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
67 |
12248
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
68 size_t MetaspaceCounters::used() { |
17866
270d7cb38f40
8038934: Remove prefix allocated_ from methods and variables in Metaspace
ehelin
parents:
14223
diff
changeset
|
69 return MetaspaceAux::used_bytes(); |
12248
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
70 } |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
71 |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
72 size_t MetaspaceCounters::capacity() { |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
73 return MetaspaceAux::committed_bytes(); |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
74 } |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
75 |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
76 size_t MetaspaceCounters::max_capacity() { |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
77 return MetaspaceAux::reserved_bytes(); |
10183
868d87ed63c8
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
8680
diff
changeset
|
78 } |
868d87ed63c8
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
8680
diff
changeset
|
79 |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
80 void MetaspaceCounters::initialize_performance_counters() { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
81 if (UsePerfData) { |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
82 assert(_perf_counters == NULL, "Should only be initialized once"); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
83 |
12248
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
84 size_t min_capacity = 0; |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
85 _perf_counters = new MetaspacePerfCounters("metaspace", min_capacity, |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
86 capacity(), max_capacity(), used()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
87 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
88 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
89 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
90 void MetaspaceCounters::update_performance_counters() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
91 if (UsePerfData) { |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
92 assert(_perf_counters != NULL, "Should be initialized"); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
93 |
12248
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
94 _perf_counters->update(capacity(), max_capacity(), used()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
95 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
96 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
97 |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
98 MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
99 |
12248
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
100 size_t CompressedClassSpaceCounters::used() { |
17866
270d7cb38f40
8038934: Remove prefix allocated_ from methods and variables in Metaspace
ehelin
parents:
14223
diff
changeset
|
101 return MetaspaceAux::used_bytes(Metaspace::ClassType); |
12248
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
102 } |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
103 |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
104 size_t CompressedClassSpaceCounters::capacity() { |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
105 return MetaspaceAux::committed_bytes(Metaspace::ClassType); |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
106 } |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
107 |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
108 size_t CompressedClassSpaceCounters::max_capacity() { |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
109 return MetaspaceAux::reserved_bytes(Metaspace::ClassType); |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
110 } |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
111 |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
112 void CompressedClassSpaceCounters::update_performance_counters() { |
12226
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
12063
diff
changeset
|
113 if (UsePerfData && UseCompressedClassPointers) { |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
114 assert(_perf_counters != NULL, "Should be initialized"); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
115 |
12248
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
116 _perf_counters->update(capacity(), max_capacity(), used()); |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
117 } |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
118 } |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
119 |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
120 void CompressedClassSpaceCounters::initialize_performance_counters() { |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
121 if (UsePerfData) { |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
122 assert(_perf_counters == NULL, "Should only be initialized once"); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
123 const char* ns = "compressedclassspace"; |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
124 |
12226
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
12063
diff
changeset
|
125 if (UseCompressedClassPointers) { |
12248
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
126 size_t min_capacity = 0; |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
127 _perf_counters = new MetaspacePerfCounters(ns, min_capacity, capacity(), |
73d0d0218068
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
12235
diff
changeset
|
128 max_capacity(), used()); |
12063
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
129 } else { |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
130 _perf_counters = new MetaspacePerfCounters(ns, 0, 0, 0, 0); |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
131 } |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
132 } |
1a8fb39bdbc4
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
10183
diff
changeset
|
133 } |