Mercurial > hg > truffle
comparison src/share/vm/memory/metaspaceCounters.cpp @ 12235:d6c266999345
8023476: Metaspace capacity > reserved
Reviewed-by: stefank, hseigel, mgerdin
author | ehelin |
---|---|
date | Thu, 12 Sep 2013 10:15:30 +0200 |
parents | 7944aba7ba41 |
children | 73d0d0218068 |
comparison
equal
deleted
inserted
replaced
12234:b82260e84582 | 12235:d6c266999345 |
---|---|
69 // The total capacity is the sum of | 69 // The total capacity is the sum of |
70 // 1) capacity of Metachunks in use by all Metaspaces | 70 // 1) capacity of Metachunks in use by all Metaspaces |
71 // 2) unused space at the end of each Metachunk | 71 // 2) unused space at the end of each Metachunk |
72 // 3) space in the freelist | 72 // 3) space in the freelist |
73 size_t total_capacity = MetaspaceAux::allocated_capacity_bytes() | 73 size_t total_capacity = MetaspaceAux::allocated_capacity_bytes() |
74 + MetaspaceAux::free_bytes() + MetaspaceAux::free_chunks_total_in_bytes(); | 74 + MetaspaceAux::free_bytes() + MetaspaceAux::free_chunks_total_bytes(); |
75 return total_capacity; | 75 return total_capacity; |
76 } | 76 } |
77 | 77 |
78 void MetaspaceCounters::initialize_performance_counters() { | 78 void MetaspaceCounters::initialize_performance_counters() { |
79 if (UsePerfData) { | 79 if (UsePerfData) { |
80 assert(_perf_counters == NULL, "Should only be initialized once"); | 80 assert(_perf_counters == NULL, "Should only be initialized once"); |
81 | 81 |
82 size_t min_capacity = MetaspaceAux::min_chunk_size(); | 82 size_t min_capacity = MetaspaceAux::min_chunk_size_bytes(); |
83 size_t capacity = calculate_capacity(); | 83 size_t capacity = calculate_capacity(); |
84 size_t max_capacity = MetaspaceAux::reserved_in_bytes(); | 84 size_t max_capacity = MetaspaceAux::reserved_bytes(); |
85 size_t used = MetaspaceAux::allocated_used_bytes(); | 85 size_t used = MetaspaceAux::allocated_used_bytes(); |
86 | 86 |
87 _perf_counters = new MetaspacePerfCounters("metaspace", min_capacity, capacity, max_capacity, used); | 87 _perf_counters = new MetaspacePerfCounters("metaspace", min_capacity, capacity, max_capacity, used); |
88 } | 88 } |
89 } | 89 } |
91 void MetaspaceCounters::update_performance_counters() { | 91 void MetaspaceCounters::update_performance_counters() { |
92 if (UsePerfData) { | 92 if (UsePerfData) { |
93 assert(_perf_counters != NULL, "Should be initialized"); | 93 assert(_perf_counters != NULL, "Should be initialized"); |
94 | 94 |
95 size_t capacity = calculate_capacity(); | 95 size_t capacity = calculate_capacity(); |
96 size_t max_capacity = MetaspaceAux::reserved_in_bytes(); | 96 size_t max_capacity = MetaspaceAux::reserved_bytes(); |
97 size_t used = MetaspaceAux::allocated_used_bytes(); | 97 size_t used = MetaspaceAux::allocated_used_bytes(); |
98 | 98 |
99 _perf_counters->update(capacity, max_capacity, used); | 99 _perf_counters->update(capacity, max_capacity, used); |
100 } | 100 } |
101 } | 101 } |
103 MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL; | 103 MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL; |
104 | 104 |
105 size_t CompressedClassSpaceCounters::calculate_capacity() { | 105 size_t CompressedClassSpaceCounters::calculate_capacity() { |
106 return MetaspaceAux::allocated_capacity_bytes(_class_type) + | 106 return MetaspaceAux::allocated_capacity_bytes(_class_type) + |
107 MetaspaceAux::free_bytes(_class_type) + | 107 MetaspaceAux::free_bytes(_class_type) + |
108 MetaspaceAux::free_chunks_total_in_bytes(_class_type); | 108 MetaspaceAux::free_chunks_total_bytes(_class_type); |
109 } | 109 } |
110 | 110 |
111 void CompressedClassSpaceCounters::update_performance_counters() { | 111 void CompressedClassSpaceCounters::update_performance_counters() { |
112 if (UsePerfData && UseCompressedClassPointers) { | 112 if (UsePerfData && UseCompressedClassPointers) { |
113 assert(_perf_counters != NULL, "Should be initialized"); | 113 assert(_perf_counters != NULL, "Should be initialized"); |
114 | 114 |
115 size_t capacity = calculate_capacity(); | 115 size_t capacity = calculate_capacity(); |
116 size_t max_capacity = MetaspaceAux::reserved_in_bytes(_class_type); | 116 size_t max_capacity = MetaspaceAux::reserved_bytes(_class_type); |
117 size_t used = MetaspaceAux::allocated_used_bytes(_class_type); | 117 size_t used = MetaspaceAux::allocated_used_bytes(_class_type); |
118 | 118 |
119 _perf_counters->update(capacity, max_capacity, used); | 119 _perf_counters->update(capacity, max_capacity, used); |
120 } | 120 } |
121 } | 121 } |
124 if (UsePerfData) { | 124 if (UsePerfData) { |
125 assert(_perf_counters == NULL, "Should only be initialized once"); | 125 assert(_perf_counters == NULL, "Should only be initialized once"); |
126 const char* ns = "compressedclassspace"; | 126 const char* ns = "compressedclassspace"; |
127 | 127 |
128 if (UseCompressedClassPointers) { | 128 if (UseCompressedClassPointers) { |
129 size_t min_capacity = MetaspaceAux::min_chunk_size(); | 129 size_t min_capacity = MetaspaceAux::min_chunk_size_bytes(); |
130 size_t capacity = calculate_capacity(); | 130 size_t capacity = calculate_capacity(); |
131 size_t max_capacity = MetaspaceAux::reserved_in_bytes(_class_type); | 131 size_t max_capacity = MetaspaceAux::reserved_bytes(_class_type); |
132 size_t used = MetaspaceAux::allocated_used_bytes(_class_type); | 132 size_t used = MetaspaceAux::allocated_used_bytes(_class_type); |
133 | 133 |
134 _perf_counters = new MetaspacePerfCounters(ns, min_capacity, capacity, max_capacity, used); | 134 _perf_counters = new MetaspacePerfCounters(ns, min_capacity, capacity, max_capacity, used); |
135 } else { | 135 } else { |
136 _perf_counters = new MetaspacePerfCounters(ns, 0, 0, 0, 0); | 136 _perf_counters = new MetaspacePerfCounters(ns, 0, 0, 0, 0); |