< prev index next >

src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp

Print this page




  61     _num_loaders_without_metaspace ++;
  62     return;
  63   }
  64 
  65   // Collect statistics for this class loader metaspace
  66   ClassLoaderMetaspaceStatistics this_cld_stat;
  67   msp->add_to_statistics(&this_cld_stat);
  68 
  69   // And add it to the running totals
  70   _stats_total.add(this_cld_stat);
  71   _num_loaders ++;
  72   _stats_by_spacetype[msp->space_type()].add(this_cld_stat);
  73   _num_loaders_by_spacetype[msp->space_type()] ++;
  74 
  75   // Optionally, print.
  76   if (_do_print) {
  77 
  78     _out->print(UINTX_FORMAT_W(4) ": ", _num_loaders);
  79 
  80     // Print "CLD for [<loader name>,] instance of <loader class name>"
  81     // or    "CLD for <anonymous class>, loaded by [<loader name>,] instance of <loader class name>"
  82 
  83     ResourceMark rm;
  84     const char* name = NULL;
  85     const char* class_name = NULL;
  86 
  87     // Note: this should also work if unloading:
  88     Klass* k = cld->class_loader_klass();
  89     if (k != NULL) {
  90       class_name = k->external_name();
  91       Symbol* s = cld->name();
  92       if (s != NULL) {
  93         name = s->as_C_string();
  94       }
  95     } else {
  96       name = "<bootstrap>";
  97     }
  98 
  99     // Print
 100     _out->print("CLD " PTR_FORMAT, p2i(cld));
 101     if (cld->is_unloading()) {
 102       _out->print(" (unloading)");
 103     }
 104     _out->print(":");
 105     if (cld->is_unsafe_anonymous()) {
 106       _out->print(" <anonymous class>, loaded by");
 107     }
 108     if (name != NULL) {
 109       _out->print(" \"%s\"", name);
 110     }
 111     if (class_name != NULL) {
 112       _out->print(" instance of %s", class_name);
 113     }
 114 
 115     if (_do_print_classes) {
 116       streamIndentor sti(_out, 6);
 117       _out->cr_indent();
 118       _out->print("Loaded classes: ");
 119       PrintMetaspaceInfoKlassClosure pkic(_out, true);
 120       cld->classes_do(&pkic);
 121       _out->cr_indent();
 122       _out->print("-total-: ");
 123       _out->print(UINTX_FORMAT " class%s", pkic._num_classes, classes_plural(pkic._num_classes));
 124       if (pkic._num_instance_classes > 0 || pkic._num_array_classes > 0) {
 125         _out->print(" (");
 126         if (pkic._num_instance_classes > 0) {




  61     _num_loaders_without_metaspace ++;
  62     return;
  63   }
  64 
  65   // Collect statistics for this class loader metaspace
  66   ClassLoaderMetaspaceStatistics this_cld_stat;
  67   msp->add_to_statistics(&this_cld_stat);
  68 
  69   // And add it to the running totals
  70   _stats_total.add(this_cld_stat);
  71   _num_loaders ++;
  72   _stats_by_spacetype[msp->space_type()].add(this_cld_stat);
  73   _num_loaders_by_spacetype[msp->space_type()] ++;
  74 
  75   // Optionally, print.
  76   if (_do_print) {
  77 
  78     _out->print(UINTX_FORMAT_W(4) ": ", _num_loaders);
  79 
  80     // Print "CLD for [<loader name>,] instance of <loader class name>"
  81     // or    "CLD for <weak nonfindable class>, loaded by [<loader name>,] instance of <loader class name>"
  82 
  83     ResourceMark rm;
  84     const char* name = NULL;
  85     const char* class_name = NULL;
  86 
  87     // Note: this should also work if unloading:
  88     Klass* k = cld->class_loader_klass();
  89     if (k != NULL) {
  90       class_name = k->external_name();
  91       Symbol* s = cld->name();
  92       if (s != NULL) {
  93         name = s->as_C_string();
  94       }
  95     } else {
  96       name = "<bootstrap>";
  97     }
  98 
  99     // Print
 100     _out->print("CLD " PTR_FORMAT, p2i(cld));
 101     if (cld->is_unloading()) {
 102       _out->print(" (unloading)");
 103     }
 104     _out->print(":");
 105     if (cld->is_shortlived()) {
 106       _out->print(" <weak nonfindable class>, loaded by");
 107     }
 108     if (name != NULL) {
 109       _out->print(" \"%s\"", name);
 110     }
 111     if (class_name != NULL) {
 112       _out->print(" instance of %s", class_name);
 113     }
 114 
 115     if (_do_print_classes) {
 116       streamIndentor sti(_out, 6);
 117       _out->cr_indent();
 118       _out->print("Loaded classes: ");
 119       PrintMetaspaceInfoKlassClosure pkic(_out, true);
 120       cld->classes_do(&pkic);
 121       _out->cr_indent();
 122       _out->print("-total-: ");
 123       _out->print(UINTX_FORMAT " class%s", pkic._num_classes, classes_plural(pkic._num_classes));
 124       if (pkic._num_instance_classes > 0 || pkic._num_array_classes > 0) {
 125         _out->print(" (");
 126         if (pkic._num_instance_classes > 0) {


< prev index next >