Mercurial > hg > truffle
comparison src/share/vm/memory/metaspaceCounters.cpp @ 12288:a7609ec351d6
Merge
author | dcubed |
---|---|
date | Fri, 20 Sep 2013 18:19:07 -0700 |
parents | 73d0d0218068 |
children | de6a9e811145 |
comparison
equal
deleted
inserted
replaced
12286:df03413ad1a9 | 12288:a7609ec351d6 |
---|---|
63 } | 63 } |
64 }; | 64 }; |
65 | 65 |
66 MetaspacePerfCounters* MetaspaceCounters::_perf_counters = NULL; | 66 MetaspacePerfCounters* MetaspaceCounters::_perf_counters = NULL; |
67 | 67 |
68 size_t MetaspaceCounters::calculate_capacity() { | 68 size_t MetaspaceCounters::used() { |
69 // The total capacity is the sum of | 69 return MetaspaceAux::allocated_used_bytes(); |
70 // 1) capacity of Metachunks in use by all Metaspaces | 70 } |
71 // 2) unused space at the end of each Metachunk | 71 |
72 // 3) space in the freelist | 72 size_t MetaspaceCounters::capacity() { |
73 size_t total_capacity = MetaspaceAux::allocated_capacity_bytes() | 73 return MetaspaceAux::committed_bytes(); |
74 + MetaspaceAux::free_bytes() + MetaspaceAux::free_chunks_total_in_bytes(); | 74 } |
75 return total_capacity; | 75 |
76 size_t MetaspaceCounters::max_capacity() { | |
77 return MetaspaceAux::reserved_bytes(); | |
76 } | 78 } |
77 | 79 |
78 void MetaspaceCounters::initialize_performance_counters() { | 80 void MetaspaceCounters::initialize_performance_counters() { |
79 if (UsePerfData) { | 81 if (UsePerfData) { |
80 assert(_perf_counters == NULL, "Should only be initialized once"); | 82 assert(_perf_counters == NULL, "Should only be initialized once"); |
81 | 83 |
82 size_t min_capacity = MetaspaceAux::min_chunk_size(); | 84 size_t min_capacity = 0; |
83 size_t capacity = calculate_capacity(); | 85 _perf_counters = new MetaspacePerfCounters("metaspace", min_capacity, |
84 size_t max_capacity = MetaspaceAux::reserved_in_bytes(); | 86 capacity(), max_capacity(), used()); |
85 size_t used = MetaspaceAux::allocated_used_bytes(); | |
86 | |
87 _perf_counters = new MetaspacePerfCounters("metaspace", min_capacity, capacity, max_capacity, used); | |
88 } | 87 } |
89 } | 88 } |
90 | 89 |
91 void MetaspaceCounters::update_performance_counters() { | 90 void MetaspaceCounters::update_performance_counters() { |
92 if (UsePerfData) { | 91 if (UsePerfData) { |
93 assert(_perf_counters != NULL, "Should be initialized"); | 92 assert(_perf_counters != NULL, "Should be initialized"); |
94 | 93 |
95 size_t capacity = calculate_capacity(); | 94 _perf_counters->update(capacity(), max_capacity(), used()); |
96 size_t max_capacity = MetaspaceAux::reserved_in_bytes(); | |
97 size_t used = MetaspaceAux::allocated_used_bytes(); | |
98 | |
99 _perf_counters->update(capacity, max_capacity, used); | |
100 } | 95 } |
101 } | 96 } |
102 | 97 |
103 MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL; | 98 MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL; |
104 | 99 |
105 size_t CompressedClassSpaceCounters::calculate_capacity() { | 100 size_t CompressedClassSpaceCounters::used() { |
106 return MetaspaceAux::allocated_capacity_bytes(_class_type) + | 101 return MetaspaceAux::allocated_used_bytes(Metaspace::ClassType); |
107 MetaspaceAux::free_bytes(_class_type) + | 102 } |
108 MetaspaceAux::free_chunks_total_in_bytes(_class_type); | 103 |
104 size_t CompressedClassSpaceCounters::capacity() { | |
105 return MetaspaceAux::committed_bytes(Metaspace::ClassType); | |
106 } | |
107 | |
108 size_t CompressedClassSpaceCounters::max_capacity() { | |
109 return MetaspaceAux::reserved_bytes(Metaspace::ClassType); | |
109 } | 110 } |
110 | 111 |
111 void CompressedClassSpaceCounters::update_performance_counters() { | 112 void CompressedClassSpaceCounters::update_performance_counters() { |
112 if (UsePerfData && UseCompressedKlassPointers) { | 113 if (UsePerfData && UseCompressedClassPointers) { |
113 assert(_perf_counters != NULL, "Should be initialized"); | 114 assert(_perf_counters != NULL, "Should be initialized"); |
114 | 115 |
115 size_t capacity = calculate_capacity(); | 116 _perf_counters->update(capacity(), max_capacity(), used()); |
116 size_t max_capacity = MetaspaceAux::reserved_in_bytes(_class_type); | |
117 size_t used = MetaspaceAux::allocated_used_bytes(_class_type); | |
118 | |
119 _perf_counters->update(capacity, max_capacity, used); | |
120 } | 117 } |
121 } | 118 } |
122 | 119 |
123 void CompressedClassSpaceCounters::initialize_performance_counters() { | 120 void CompressedClassSpaceCounters::initialize_performance_counters() { |
124 if (UsePerfData) { | 121 if (UsePerfData) { |
125 assert(_perf_counters == NULL, "Should only be initialized once"); | 122 assert(_perf_counters == NULL, "Should only be initialized once"); |
126 const char* ns = "compressedclassspace"; | 123 const char* ns = "compressedclassspace"; |
127 | 124 |
128 if (UseCompressedKlassPointers) { | 125 if (UseCompressedClassPointers) { |
129 size_t min_capacity = MetaspaceAux::min_chunk_size(); | 126 size_t min_capacity = 0; |
130 size_t capacity = calculate_capacity(); | 127 _perf_counters = new MetaspacePerfCounters(ns, min_capacity, capacity(), |
131 size_t max_capacity = MetaspaceAux::reserved_in_bytes(_class_type); | 128 max_capacity(), used()); |
132 size_t used = MetaspaceAux::allocated_used_bytes(_class_type); | |
133 | |
134 _perf_counters = new MetaspacePerfCounters(ns, min_capacity, capacity, max_capacity, used); | |
135 } else { | 129 } else { |
136 _perf_counters = new MetaspacePerfCounters(ns, 0, 0, 0, 0); | 130 _perf_counters = new MetaspacePerfCounters(ns, 0, 0, 0, 0); |
137 } | 131 } |
138 } | 132 } |
139 } | 133 } |