src/share/vm/services/classLoadingService.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot-npg Sdiff src/share/vm/services

src/share/vm/services/classLoadingService.cpp

Print this page




  61 #define DTRACE_CLASSLOAD_PROBE(type, clss, shared)  \
  62   {                                                 \
  63     char* data = NULL;                              \
  64     int len = 0;                                    \
  65     Symbol* name = (clss)->name();                  \
  66     if (name != NULL) {                             \
  67       data = (char*)name->bytes();                  \
  68       len = name->utf8_length();                    \
  69     }                                               \
  70     HOTSPOT_CLASS_##type( /* type = unloaded, loaded */ \
  71       data, len, (clss)->class_loader(), (shared)); \
  72   }
  73 
  74 #endif /* USDT2 */
  75 #else //  ndef DTRACE_ENABLED
  76 
  77 #define DTRACE_CLASSLOAD_PROBE(type, clss, shared)
  78 
  79 #endif
  80 

  81 // counters for classes loaded from class files
  82 PerfCounter*    ClassLoadingService::_classes_loaded_count = NULL;
  83 PerfCounter*    ClassLoadingService::_classes_unloaded_count = NULL;
  84 PerfCounter*    ClassLoadingService::_classbytes_loaded = NULL;
  85 PerfCounter*    ClassLoadingService::_classbytes_unloaded = NULL;
  86 
  87 // counters for classes loaded from shared archive
  88 PerfCounter*    ClassLoadingService::_shared_classes_loaded_count = NULL;
  89 PerfCounter*    ClassLoadingService::_shared_classes_unloaded_count = NULL;
  90 PerfCounter*    ClassLoadingService::_shared_classbytes_loaded = NULL;
  91 PerfCounter*    ClassLoadingService::_shared_classbytes_unloaded = NULL;
  92 PerfVariable*   ClassLoadingService::_class_methods_size = NULL;
  93 
  94 void ClassLoadingService::init() {
  95   EXCEPTION_MARK;
  96 
  97   // These counters are for java.lang.management API support.
  98   // They are created even if -XX:-UsePerfData is set and in
  99   // that case, they will be allocated on C heap.
 100   _classes_loaded_count =


 222   assert(cur_thread == Thread::current(), "Check current thread");
 223 
 224   int init_size = ClassLoadingService::loaded_class_count();
 225   _klass_handle_array = new GrowableArray<KlassHandle>(init_size);
 226 
 227   // For consistency of the loaded classes, grab the SystemDictionary lock
 228   MutexLocker sd_mutex(SystemDictionary_lock);
 229 
 230   // Set _loaded_classes and _current_thread and begin enumerating all classes.
 231   // Only one thread will do the enumeration at a time.
 232   // These static variables are needed and they are used by the static method
 233   // add_loaded_class called from classes_do().
 234   _loaded_classes = _klass_handle_array;
 235   _current_thread = cur_thread;
 236 
 237   SystemDictionary::classes_do(&add_loaded_class);
 238 
 239   // FIXME: Exclude array klasses for now
 240   // Universe::basic_type_classes_do(&add_loaded_class);
 241 }




  61 #define DTRACE_CLASSLOAD_PROBE(type, clss, shared)  \
  62   {                                                 \
  63     char* data = NULL;                              \
  64     int len = 0;                                    \
  65     Symbol* name = (clss)->name();                  \
  66     if (name != NULL) {                             \
  67       data = (char*)name->bytes();                  \
  68       len = name->utf8_length();                    \
  69     }                                               \
  70     HOTSPOT_CLASS_##type( /* type = unloaded, loaded */ \
  71       data, len, (clss)->class_loader(), (shared)); \
  72   }
  73 
  74 #endif /* USDT2 */
  75 #else //  ndef DTRACE_ENABLED
  76 
  77 #define DTRACE_CLASSLOAD_PROBE(type, clss, shared)
  78 
  79 #endif
  80 
  81 #if INCLUDE_MANAGEMENT
  82 // counters for classes loaded from class files
  83 PerfCounter*    ClassLoadingService::_classes_loaded_count = NULL;
  84 PerfCounter*    ClassLoadingService::_classes_unloaded_count = NULL;
  85 PerfCounter*    ClassLoadingService::_classbytes_loaded = NULL;
  86 PerfCounter*    ClassLoadingService::_classbytes_unloaded = NULL;
  87 
  88 // counters for classes loaded from shared archive
  89 PerfCounter*    ClassLoadingService::_shared_classes_loaded_count = NULL;
  90 PerfCounter*    ClassLoadingService::_shared_classes_unloaded_count = NULL;
  91 PerfCounter*    ClassLoadingService::_shared_classbytes_loaded = NULL;
  92 PerfCounter*    ClassLoadingService::_shared_classbytes_unloaded = NULL;
  93 PerfVariable*   ClassLoadingService::_class_methods_size = NULL;
  94 
  95 void ClassLoadingService::init() {
  96   EXCEPTION_MARK;
  97 
  98   // These counters are for java.lang.management API support.
  99   // They are created even if -XX:-UsePerfData is set and in
 100   // that case, they will be allocated on C heap.
 101   _classes_loaded_count =


 223   assert(cur_thread == Thread::current(), "Check current thread");
 224 
 225   int init_size = ClassLoadingService::loaded_class_count();
 226   _klass_handle_array = new GrowableArray<KlassHandle>(init_size);
 227 
 228   // For consistency of the loaded classes, grab the SystemDictionary lock
 229   MutexLocker sd_mutex(SystemDictionary_lock);
 230 
 231   // Set _loaded_classes and _current_thread and begin enumerating all classes.
 232   // Only one thread will do the enumeration at a time.
 233   // These static variables are needed and they are used by the static method
 234   // add_loaded_class called from classes_do().
 235   _loaded_classes = _klass_handle_array;
 236   _current_thread = cur_thread;
 237 
 238   SystemDictionary::classes_do(&add_loaded_class);
 239 
 240   // FIXME: Exclude array klasses for now
 241   // Universe::basic_type_classes_do(&add_loaded_class);
 242 }
 243 
 244 #endif // INCLUDE_MANAGEMENT
src/share/vm/services/classLoadingService.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File