< prev index next >

src/hotspot/share/classfile/classLoaderStats.cpp

Print this page




  42     _num_classes++;
  43   }
  44 };
  45 
  46 
  47 void ClassLoaderStatsClosure::do_cld(ClassLoaderData* cld) {
  48   oop cl = cld->class_loader();
  49   ClassLoaderStats* cls;
  50 
  51   // The hashtable key is the ClassLoader oop since we want to account
  52   // for "real" classes and anonymous classes together
  53   ClassLoaderStats** cls_ptr = _stats->get(cl);
  54   if (cls_ptr == NULL) {
  55     cls = new ClassLoaderStats();
  56     _stats->put(cl, cls);
  57     _total_loaders++;
  58   } else {
  59     cls = *cls_ptr;
  60   }
  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
 102 
 103 




  42     _num_classes++;
  43   }
  44 };
  45 
  46 
  47 void ClassLoaderStatsClosure::do_cld(ClassLoaderData* cld) {
  48   oop cl = cld->class_loader();
  49   ClassLoaderStats* cls;
  50 
  51   // The hashtable key is the ClassLoader oop since we want to account
  52   // for "real" classes and anonymous classes together
  53   ClassLoaderStats** cls_ptr = _stats->get(cl);
  54   if (cls_ptr == NULL) {
  55     cls = new ClassLoaderStats();
  56     _stats->put(cl, cls);
  57     _total_loaders++;
  58   } else {
  59     cls = *cls_ptr;
  60   }
  61 
  62   if (!cld->is_shortlived()) {
  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_shortlived()) {
  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_shortlived()) {
  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
 102 
 103 


< prev index next >