6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
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
25 #include "precompiled.hpp"
26 #include "classfile/classLoaderData.inline.hpp"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "classfile/classLoaderStats.hpp"
29 #include "oops/oop.inline.hpp"
30 #include "utilities/globalDefinitions.hpp"
31
32
33 class ClassStatsClosure : public KlassClosure {
34 public:
35 int _num_classes;
36
37 ClassStatsClosure() :
38 _num_classes(0) {
39 }
40
41 virtual void do_klass(Klass* k) {
42 _num_classes++;
43 }
44 };
45
61
62 if (!cld->is_unsafe_anonymous()) {
63 cls->_cld = cld;
64 }
65
66 cls->_class_loader = cl;
67 if (cl != NULL) {
68 cls->_parent = java_lang_ClassLoader::parent(cl);
69 addEmptyParents(cls->_parent);
70 }
71
72 ClassStatsClosure csc;
73 cld->classes_do(&csc);
74 if(cld->is_unsafe_anonymous()) {
75 cls->_anon_classes_count += csc._num_classes;
76 } else {
77 cls->_classes_count = csc._num_classes;
78 }
79 _total_classes += csc._num_classes;
80
81 ClassLoaderMetaspace* ms = cld->metaspace_or_null();
82 if (ms != NULL) {
83 if(cld->is_unsafe_anonymous()) {
84 cls->_anon_chunk_sz += ms->allocated_chunks_bytes();
85 cls->_anon_block_sz += ms->allocated_blocks_bytes();
86 } else {
87 cls->_chunk_sz = ms->allocated_chunks_bytes();
88 cls->_block_sz = ms->allocated_blocks_bytes();
89 }
90 _total_chunk_sz += ms->allocated_chunks_bytes();
91 _total_block_sz += ms->allocated_blocks_bytes();
92 }
93 }
94
95
96 // Handles the difference in pointer width on 32 and 64 bit platforms
97 #ifdef _LP64
98 #define SPACE "%8s"
99 #else
100 #define SPACE "%s"
101 #endif
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
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
25 #include "precompiled.hpp"
26 #include "memory/metaspace/classLoaderMetaspace.hpp"
27 #include "classfile/classLoaderData.inline.hpp"
28 #include "classfile/classLoaderDataGraph.hpp"
29 #include "classfile/classLoaderStats.hpp"
30 #include "oops/oop.inline.hpp"
31 #include "utilities/globalDefinitions.hpp"
32
33
34 class ClassStatsClosure : public KlassClosure {
35 public:
36 int _num_classes;
37
38 ClassStatsClosure() :
39 _num_classes(0) {
40 }
41
42 virtual void do_klass(Klass* k) {
43 _num_classes++;
44 }
45 };
46
62
63 if (!cld->is_unsafe_anonymous()) {
64 cls->_cld = cld;
65 }
66
67 cls->_class_loader = cl;
68 if (cl != NULL) {
69 cls->_parent = java_lang_ClassLoader::parent(cl);
70 addEmptyParents(cls->_parent);
71 }
72
73 ClassStatsClosure csc;
74 cld->classes_do(&csc);
75 if(cld->is_unsafe_anonymous()) {
76 cls->_anon_classes_count += csc._num_classes;
77 } else {
78 cls->_classes_count = csc._num_classes;
79 }
80 _total_classes += csc._num_classes;
81
82 metaspace::ClassLoaderMetaspace* ms = cld->metaspace_or_null();
83 if (ms != NULL) {
84 if(cld->is_unsafe_anonymous()) {
85 cls->_anon_chunk_sz += ms->allocated_chunks_bytes();
86 cls->_anon_block_sz += ms->allocated_blocks_bytes();
87 } else {
88 cls->_chunk_sz = ms->allocated_chunks_bytes();
89 cls->_block_sz = ms->allocated_blocks_bytes();
90 }
91 _total_chunk_sz += ms->allocated_chunks_bytes();
92 _total_block_sz += ms->allocated_blocks_bytes();
93 }
94 }
95
96
97 // Handles the difference in pointer width on 32 and 64 bit platforms
98 #ifdef _LP64
99 #define SPACE "%8s"
100 #else
101 #define SPACE "%s"
102 #endif
|