1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "classfile/compactHashtable.inline.hpp" |
26 #include "classfile/compactHashtable.inline.hpp" |
27 #include "classfile/javaClasses.hpp" |
27 #include "classfile/javaClasses.hpp" |
|
28 #include "logging/logMessage.hpp" |
28 #include "memory/metadataFactory.hpp" |
29 #include "memory/metadataFactory.hpp" |
29 #include "memory/metaspaceShared.hpp" |
30 #include "memory/metaspaceShared.hpp" |
30 #include "prims/jvm.h" |
31 #include "prims/jvm.h" |
31 #include "utilities/numberSeq.hpp" |
32 #include "utilities/numberSeq.hpp" |
32 #include <sys/stat.h> |
33 #include <sys/stat.h> |
144 int table_bytes = _stats->bucket_bytes + _stats->hashentry_bytes; |
145 int table_bytes = _stats->bucket_bytes + _stats->hashentry_bytes; |
145 address base_address = address(MetaspaceShared::shared_rs()->base()); |
146 address base_address = address(MetaspaceShared::shared_rs()->base()); |
146 cht->init(base_address, _num_entries, _num_buckets, |
147 cht->init(base_address, _num_entries, _num_buckets, |
147 _compact_buckets->data(), _compact_entries->data()); |
148 _compact_buckets->data(), _compact_entries->data()); |
148 |
149 |
149 if (PrintSharedSpaces) { |
150 if (log_is_enabled(Info, cds, hashtables)) { |
|
151 ResourceMark rm; |
|
152 LogMessage(cds, hashtables) msg; |
|
153 stringStream info_stream; |
|
154 |
150 double avg_cost = 0.0; |
155 double avg_cost = 0.0; |
151 if (_num_entries > 0) { |
156 if (_num_entries > 0) { |
152 avg_cost = double(table_bytes)/double(_num_entries); |
157 avg_cost = double(table_bytes)/double(_num_entries); |
153 } |
158 } |
154 tty->print_cr("Shared %s table stats -------- base: " PTR_FORMAT, |
159 info_stream.print_cr("Shared %s table stats -------- base: " PTR_FORMAT, |
155 table_name, (intptr_t)base_address); |
160 table_name, (intptr_t)base_address); |
156 tty->print_cr("Number of entries : %9d", _num_entries); |
161 info_stream.print_cr("Number of entries : %9d", _num_entries); |
157 tty->print_cr("Total bytes used : %9d", table_bytes); |
162 info_stream.print_cr("Total bytes used : %9d", table_bytes); |
158 tty->print_cr("Average bytes per entry : %9.3f", avg_cost); |
163 info_stream.print_cr("Average bytes per entry : %9.3f", avg_cost); |
159 tty->print_cr("Average bucket size : %9.3f", summary.avg()); |
164 info_stream.print_cr("Average bucket size : %9.3f", summary.avg()); |
160 tty->print_cr("Variance of bucket size : %9.3f", summary.variance()); |
165 info_stream.print_cr("Variance of bucket size : %9.3f", summary.variance()); |
161 tty->print_cr("Std. dev. of bucket size: %9.3f", summary.sd()); |
166 info_stream.print_cr("Std. dev. of bucket size: %9.3f", summary.sd()); |
162 tty->print_cr("Empty buckets : %9d", _num_empty_buckets); |
167 info_stream.print_cr("Empty buckets : %9d", _num_empty_buckets); |
163 tty->print_cr("Value_Only buckets : %9d", _num_value_only_buckets); |
168 info_stream.print_cr("Value_Only buckets : %9d", _num_value_only_buckets); |
164 tty->print_cr("Other buckets : %9d", _num_other_buckets); |
169 info_stream.print_cr("Other buckets : %9d", _num_other_buckets); |
|
170 msg.info("%s", info_stream.as_string()); |
165 } |
171 } |
166 } |
172 } |
167 |
173 |
168 ///////////////////////////////////////////////////////////// |
174 ///////////////////////////////////////////////////////////// |
169 // |
175 // |