Mercurial > hg > graal-compiler
comparison src/share/vm/oops/instanceKlass.cpp @ 7956:16fb9f942703
6479360: PrintClassHistogram improvements
Summary: jcmd <pid> GC.class_stats (UnlockDiagnosticVMOptions)
Reviewed-by: coleenp, hseigel, sla, acorn
Contributed-by: ioi.lam@oracle.com
author | acorn |
---|---|
date | Fri, 25 Jan 2013 15:06:18 -0500 |
parents | ed6154d7d259 |
children | 3c9bc17b9403 |
comparison
equal
deleted
inserted
replaced
7950:6cf2530f7fd3 | 7956:16fb9f942703 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, 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. |
32 #include "gc_interface/collectedHeap.inline.hpp" | 32 #include "gc_interface/collectedHeap.inline.hpp" |
33 #include "interpreter/oopMapCache.hpp" | 33 #include "interpreter/oopMapCache.hpp" |
34 #include "interpreter/rewriter.hpp" | 34 #include "interpreter/rewriter.hpp" |
35 #include "jvmtifiles/jvmti.h" | 35 #include "jvmtifiles/jvmti.h" |
36 #include "memory/genOopClosures.inline.hpp" | 36 #include "memory/genOopClosures.inline.hpp" |
37 #include "memory/heapInspection.hpp" | |
37 #include "memory/metadataFactory.hpp" | 38 #include "memory/metadataFactory.hpp" |
38 #include "memory/oopFactory.hpp" | 39 #include "memory/oopFactory.hpp" |
39 #include "oops/fieldStreams.hpp" | 40 #include "oops/fieldStreams.hpp" |
40 #include "oops/instanceClassLoaderKlass.hpp" | 41 #include "oops/instanceClassLoaderKlass.hpp" |
41 #include "oops/instanceKlass.hpp" | 42 #include "oops/instanceKlass.hpp" |
2958 | 2959 |
2959 const char* InstanceKlass::internal_name() const { | 2960 const char* InstanceKlass::internal_name() const { |
2960 return external_name(); | 2961 return external_name(); |
2961 } | 2962 } |
2962 | 2963 |
2964 #if INCLUDE_SERVICES | |
2965 // Size Statistics | |
2966 void InstanceKlass::collect_statistics(KlassSizeStats *sz) const { | |
2967 Klass::collect_statistics(sz); | |
2968 | |
2969 sz->_inst_size = HeapWordSize * size_helper(); | |
2970 sz->_vtab_bytes = HeapWordSize * align_object_offset(vtable_length()); | |
2971 sz->_itab_bytes = HeapWordSize * align_object_offset(itable_length()); | |
2972 sz->_nonstatic_oopmap_bytes = HeapWordSize * | |
2973 ((is_interface() || is_anonymous()) ? | |
2974 align_object_offset(nonstatic_oop_map_size()) : | |
2975 nonstatic_oop_map_size()); | |
2976 | |
2977 int n = 0; | |
2978 n += (sz->_methods_array_bytes = sz->count_array(methods())); | |
2979 n += (sz->_method_ordering_bytes = sz->count_array(method_ordering())); | |
2980 n += (sz->_local_interfaces_bytes = sz->count_array(local_interfaces())); | |
2981 n += (sz->_transitive_interfaces_bytes = sz->count_array(transitive_interfaces())); | |
2982 n += (sz->_signers_bytes = sz->count_array(signers())); | |
2983 n += (sz->_fields_bytes = sz->count_array(fields())); | |
2984 n += (sz->_inner_classes_bytes = sz->count_array(inner_classes())); | |
2985 sz->_ro_bytes += n; | |
2986 | |
2987 const ConstantPool* cp = constants(); | |
2988 if (cp) { | |
2989 cp->collect_statistics(sz); | |
2990 } | |
2991 | |
2992 const Annotations* anno = annotations(); | |
2993 if (anno) { | |
2994 anno->collect_statistics(sz); | |
2995 } | |
2996 | |
2997 const Array<Method*>* methods_array = methods(); | |
2998 if (methods()) { | |
2999 for (int i = 0; i < methods_array->length(); i++) { | |
3000 Method* method = methods_array->at(i); | |
3001 if (method) { | |
3002 sz->_method_count ++; | |
3003 method->collect_statistics(sz); | |
3004 } | |
3005 } | |
3006 } | |
3007 } | |
3008 #endif // INCLUDE_SERVICES | |
3009 | |
2963 // Verification | 3010 // Verification |
2964 | 3011 |
2965 class VerifyFieldClosure: public OopClosure { | 3012 class VerifyFieldClosure: public OopClosure { |
2966 protected: | 3013 protected: |
2967 template <class T> void do_oop_work(T* p) { | 3014 template <class T> void do_oop_work(T* p) { |