Mercurial > hg > graal-compiler
annotate src/share/vm/memory/metaspaceCounters.cpp @ 9809:a8a5d5832def
first step towards extensibility of the escape analysis phase
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 17 May 2013 16:47:13 +0200 |
parents | 0624b9d81255 |
children | 868d87ed63c8 |
rev | line source |
---|---|
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 /* |
7440 | 2 * Copyright (c) 2012, 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" |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
28 #include "utilities/exceptions.hpp" |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
29 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
30 MetaspaceCounters* MetaspaceCounters::_metaspace_counters = NULL; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
31 |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
32 MetaspaceCounters::MetaspaceCounters() : |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
33 _capacity(NULL), |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
34 _used(NULL), |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
35 _max_capacity(NULL) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
36 if (UsePerfData) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
37 size_t min_capacity = MetaspaceAux::min_chunk_size(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
38 size_t max_capacity = MetaspaceAux::reserved_in_bytes(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
39 size_t curr_capacity = MetaspaceAux::capacity_in_bytes(); |
6734 | 40 size_t used = MetaspaceAux::used_in_bytes(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
41 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
42 initialize(min_capacity, max_capacity, curr_capacity, used); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
43 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
44 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
45 |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
46 static PerfVariable* create_ms_variable(const char *ns, |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
47 const char *name, |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
48 size_t value, |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
49 TRAPS) { |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
50 const char *path = PerfDataManager::counter_name(ns, name); |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
51 PerfVariable *result = |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
52 PerfDataManager::create_variable(SUN_GC, path, PerfData::U_Bytes, value, |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
53 CHECK_NULL); |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
54 return result; |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
55 } |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
56 |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
57 static void create_ms_constant(const char *ns, |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
58 const char *name, |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
59 size_t value, |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
60 TRAPS) { |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
61 const char *path = PerfDataManager::counter_name(ns, name); |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
62 PerfDataManager::create_constant(SUN_GC, path, PerfData::U_Bytes, value, CHECK); |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
63 } |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
64 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
65 void MetaspaceCounters::initialize(size_t min_capacity, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
66 size_t max_capacity, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
67 size_t curr_capacity, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
68 size_t used) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
69 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
70 if (UsePerfData) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
71 EXCEPTION_MARK; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
72 ResourceMark rm; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
73 |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
74 const char *ms = "metaspace"; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
75 |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
76 create_ms_constant(ms, "minCapacity", min_capacity, CHECK); |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
77 _max_capacity = create_ms_variable(ms, "maxCapacity", max_capacity, CHECK); |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
78 _capacity = create_ms_variable(ms, "capacity", curr_capacity, CHECK); |
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
79 _used = create_ms_variable(ms, "used", used, CHECK); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
80 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
81 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
82 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
83 void MetaspaceCounters::update_capacity() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
84 assert(UsePerfData, "Should not be called unless being used"); |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
85 assert(_capacity != NULL, "Should be initialized"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
86 size_t capacity_in_bytes = MetaspaceAux::capacity_in_bytes(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
87 _capacity->set_value(capacity_in_bytes); |
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_used() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
91 assert(UsePerfData, "Should not be called unless being used"); |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
92 assert(_used != NULL, "Should be initialized"); |
6734 | 93 size_t used_in_bytes = MetaspaceAux::used_in_bytes(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
94 _used->set_value(used_in_bytes); |
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 void MetaspaceCounters::update_max_capacity() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
98 assert(UsePerfData, "Should not be called unless being used"); |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
99 assert(_max_capacity != NULL, "Should be initialized"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
100 size_t reserved_in_bytes = MetaspaceAux::reserved_in_bytes(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
101 _max_capacity->set_value(reserved_in_bytes); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
102 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
103 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
104 void MetaspaceCounters::update_all() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
105 if (UsePerfData) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
106 update_used(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
107 update_capacity(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
108 update_max_capacity(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
109 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
110 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
111 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
112 void MetaspaceCounters::initialize_performance_counters() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
113 if (UsePerfData) { |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
114 assert(_metaspace_counters == NULL, "Should only be initialized once"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
115 _metaspace_counters = new MetaspaceCounters(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
116 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
117 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
118 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
119 void MetaspaceCounters::update_performance_counters() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
120 if (UsePerfData) { |
8680
0624b9d81255
8004172: Update jstat counter names to reflect metaspace changes
ehelin
parents:
7440
diff
changeset
|
121 assert(_metaspace_counters != NULL, "Should be initialized"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
122 _metaspace_counters->update_all(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
123 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
124 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
125 |