14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #include "precompiled.hpp"
25 #include "classfile/classLoaderData.hpp"
26 #include "memory/metaspace/printCLDMetaspaceInfoClosure.hpp"
27 #include "memory/resourceArea.hpp"
28 #include "runtime/safepoint.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/ostream.hpp"
31
32
33 namespace metaspace {
34 namespace internals {
35
36 PrintCLDMetaspaceInfoClosure::PrintCLDMetaspaceInfoClosure(outputStream* out, size_t scale, bool do_print, bool break_down_by_chunktype)
37 : _out(out), _scale(scale), _do_print(do_print), _break_down_by_chunktype(break_down_by_chunktype)
38 , _num_loaders(0)
39 {
40 memset(_num_loaders_by_spacetype, 0, sizeof(_num_loaders_by_spacetype));
41 }
42
43 void PrintCLDMetaspaceInfoClosure::do_cld(ClassLoaderData* cld) {
44
45 assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
46
47 ClassLoaderMetaspace* msp = cld->metaspace_or_null();
48 if (msp == NULL) {
49 return;
50 }
51
52 // Collect statistics for this class loader metaspace
53 ClassLoaderMetaspaceStatistics this_cld_stat;
54 msp->add_to_statistics(&this_cld_stat);
66
67 if (cld->is_anonymous()) {
68 _out->print("ClassLoaderData " PTR_FORMAT " for anonymous class", p2i(cld));
69 } else {
70 ResourceMark rm;
71 _out->print("ClassLoaderData " PTR_FORMAT " for %s", p2i(cld), cld->loader_name());
72 }
73
74 if (cld->is_unloading()) {
75 _out->print(" (unloading)");
76 }
77
78 this_cld_stat.print_on(_out, _scale, _break_down_by_chunktype);
79 _out->cr();
80
81 }
82
83 }
84
85 } // namespace metaspace
86 } // namespace internals
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #include "precompiled.hpp"
25 #include "classfile/classLoaderData.hpp"
26 #include "memory/metaspace/printCLDMetaspaceInfoClosure.hpp"
27 #include "memory/resourceArea.hpp"
28 #include "runtime/safepoint.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/ostream.hpp"
31
32
33 namespace metaspace {
34
35 PrintCLDMetaspaceInfoClosure::PrintCLDMetaspaceInfoClosure(outputStream* out, size_t scale, bool do_print, bool break_down_by_chunktype)
36 : _out(out), _scale(scale), _do_print(do_print), _break_down_by_chunktype(break_down_by_chunktype)
37 , _num_loaders(0)
38 {
39 memset(_num_loaders_by_spacetype, 0, sizeof(_num_loaders_by_spacetype));
40 }
41
42 void PrintCLDMetaspaceInfoClosure::do_cld(ClassLoaderData* cld) {
43
44 assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
45
46 ClassLoaderMetaspace* msp = cld->metaspace_or_null();
47 if (msp == NULL) {
48 return;
49 }
50
51 // Collect statistics for this class loader metaspace
52 ClassLoaderMetaspaceStatistics this_cld_stat;
53 msp->add_to_statistics(&this_cld_stat);
65
66 if (cld->is_anonymous()) {
67 _out->print("ClassLoaderData " PTR_FORMAT " for anonymous class", p2i(cld));
68 } else {
69 ResourceMark rm;
70 _out->print("ClassLoaderData " PTR_FORMAT " for %s", p2i(cld), cld->loader_name());
71 }
72
73 if (cld->is_unloading()) {
74 _out->print(" (unloading)");
75 }
76
77 this_cld_stat.print_on(_out, _scale, _break_down_by_chunktype);
78 _out->cr();
79
80 }
81
82 }
83
84 } // namespace metaspace
85
|